QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#651625 | #5419. Triangles | ucup-team3161# | WA | 0ms | 3792kb | C++17 | 3.0kb | 2024-10-18 17:52:59 | 2024-10-18 17:53:05 |
Judging History
answer
#include <bits/stdc++.h>
#define For(i,x,y) for (int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (int i=(x);i<(y);i++)
#define Dow(i,x,y) for (int i=(x);i>=(y);i--)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define siz(x) ((int)x.size())
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef vector<int> poly;
inline ll read(){
ll x;
scanf("%lld",&x);
return x;
}
int n;
struct P{
int x,y;
P(int xx=0,int yy=0){x=xx,y=yy;}
};
P operator +(P a,P b){
return P((a.x+b.x)/2,(a.y+b.y)/2);
}
int V=1e7;
int now=0;
bool isok(P a,P b){
return ((a.x+b.x)%2==0) && ((a.y+b.y)%2==0);
}
struct tri{
P a,b,c;
bool iso(){
return isok(a,b) && isok(b,c) && isok(c,a);
}
void out(){
cout<<a.x<<" "<<a.y<<" "<<b.x<<" "<<b.y<<" "<<c.x<<" "<<c.y<<"\n";
}
};
vector<tri>res;
bool mul;
void add(P a,P b,P c){
if(mul){
a.x*=V,a.y*=V;
b.x*=V,b.y*=V;
c.x*=V,c.y*=V;
}
res.pb((tri){a,b,c});
}
void add(int a,int b,int c,int d,int e,int f){
return add(P(a,b),P(c,d),P(e,f));
}
void op8(){
mul=1;
add(0,0,0,100,48,90);
add(100,100,100,0,52,90);
//OP
add(0,100,50,100,48,90);
add(50,100,48,90,52,90);
add(52,90,100,100,50,100);
add(0,0,48,90,50,0);
add(48,90,52,90,50,0);
add(52,90,50,0,100,0);
mul=0;
now=8;
}
void op10(){
mul=1;
add(0,0,0,100,48,90);
add(100,100,100,0,52,90);
P a=P(48,90),b=P(52,90);
P c=P(49,100),d=P(51,100),e=P(50,90);
add(a,c,P(0,100));
add(a,c,e);
add(c,d,e);
add(d,e,b);
add(d,b,P(100,100));
add(0,0,48,90,50,0);
add(48,90,52,90,50,0);
add(52,90,50,0,100,0);
mul=0;
now=10;
}
void op12(){
mul=1;
add(0,0,0,100,48,90);
add(100,100,100,0,52,90);
P a=P(48,90),b=P(52,90);
P c=P(49,100),d=P(51,100),e=P(50,90);
add(a,c,P(0,100));
add(a,c,e);
add(c,d,e);
add(d,e,b);
add(d,b,P(100,100));
c.y=d.y=0;
add(a,c,P(0,0));
add(a,c,e);
add(c,d,e);
add(d,e,b);
add(d,b,P(100,0));
mul=0;
now=10;
}
void add3(){
vector<tri>nw;
For(i,0,res.size()-1){
if(res[i].iso()){
P a=res[i].a,b=res[i].b,c=res[i].c;
For(j,0,res.size()-1) if(i!=j) nw.pb(res[j]);
res=nw;
P ab=(a+b),bc=(b+c),ca=(a+c);
add(ab,bc,ca);
add(a,ab,ca);
add(b,ab,bc);
add(c,ca,bc);
return;
}
}
assert(0);
}
int main(){
cin>>n;
if(n<=7 || n==9) {
puts("No"); exit(0);
}
if(n%3==2) op8();
else if(n%3==1) op10();
else if(n%3==0) op12();
while(res.size()<n) add3();
assert(res.size()==n);
puts("Yes");
for(auto it:res)it.out();
return 0;
}
/*
6
1000000000
1
3
7
10
20221218
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3556kb
input:
2
output:
No
result:
ok no solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
24
output:
Yes 490000000 1000000000 510000000 1000000000 500000000 900000000 510000000 1000000000 500000000 900000000 520000000 900000000 510000000 1000000000 520000000 900000000 1000000000 1000000000 480000000 900000000 490000000 0 0 0 480000000 900000000 490000000 0 500000000 900000000 490000000 0 510000000 ...
result:
ok 24 acute triangles
Test #3:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
1
output:
No
result:
ok no solution
Test #4:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
3
output:
No
result:
ok no solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
4
output:
No
result:
ok no solution
Test #6:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
5
output:
No
result:
ok no solution
Test #7:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
6
output:
No
result:
ok no solution
Test #8:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
7
output:
No
result:
ok no solution
Test #9:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
8
output:
Yes 0 0 0 1000000000 480000000 900000000 1000000000 1000000000 1000000000 0 520000000 900000000 0 1000000000 500000000 1000000000 480000000 900000000 500000000 1000000000 480000000 900000000 520000000 900000000 520000000 900000000 1000000000 1000000000 500000000 1000000000 0 0 480000000 900000000 50...
result:
ok 8 acute triangles
Test #10:
score: -100
Wrong Answer
time: 0ms
memory: 3520kb
input:
9
output:
No
result:
wrong answer feasible solution not found