QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#76149 | #5419. Triangles | AFewSuns | WA | 4ms | 3760kb | C++14 | 3.9kb | 2023-02-07 21:59:29 | 2023-02-07 21:59:31 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
namespace my_std{
#define ll long long
#define bl bool
ll my_pow(ll a,ll b,ll mod){
ll res=1;
if(!b) return 1;
while(b){
if(b&1) res=(res*a)%mod;
a=(a*a)%mod;
b>>=1;
}
return res;
}
ll qpow(ll a,ll b){
ll res=1;
if(!b) return 1;
while(b){
if(b&1) res*=a;
a*=a;
b>>=1;
}
return res;
}
#define db double
#define pf printf
#define pc putchar
#define fr(i,x,y) for(register ll i=(x);i<=(y);i++)
#define pfr(i,x,y) for(register ll i=(x);i>=(y);i--)
#define go(u) for(ll i=head[u];i;i=e[i].nxt)
#define enter pc('\n')
#define space pc(' ')
#define fir first
#define sec second
#define MP make_pair
#define il inline
#define inf 8e18
#define random(x) rand()*rand()%(x)
#define inv(a,mod) my_pow((a),(mod-2),(mod))
il ll read(){
ll sum=0,f=1;
char ch=0;
while(!isdigit(ch)){
if(ch=='-') f=-1;
ch=getchar();
}
while(isdigit(ch)){
sum=sum*10+(ch^48);
ch=getchar();
}
return sum*f;
}
il void write(ll x){
if(x<0){
x=-x;
pc('-');
}
if(x>9) write(x/10);
pc(x%10+'0');
}
il void writeln(ll x){
write(x);
enter;
}
il void writesp(ll x){
write(x);
space;
}
}
using namespace my_std;
ll n,l=1,r=0,lim=1e7;
struct point{
ll x,y;
};
point operator+(const point &x,const point &y){
return (point){x.x+y.x,x.y+y.y};
}
point operator/(const point &x,const ll &y){
return (point){x.x/y,x.y/y};
}
point operator*(const point &x,const ll &y){
return (point){x.x*y,x.y*y};
}
struct tri{
point x,y,z;
il void print(){
pf("%lld %lld %lld %lld %lld %lld\n",x.x,x.y,y.x,y.y,z.x,z.y);
}
}q[55];
void solve1(){
n-=8;
q[++r]=(tri){(point){0,0},(point){0,100},(point){45,20}};
q[++r]=(tri){(point){0,100},(point){50,100},(point){45,20}};
q[++r]=(tri){(point){0,0},(point){50,0},(point){45,20}};
q[++r]=(tri){(point){50,100},(point){55,20},(point){45,20}};
q[++r]=(tri){(point){50,0},(point){55,20},(point){45,20}};
q[++r]=(tri){(point){50,100},(point){55,20},(point){100,100}};
q[++r]=(tri){(point){50,0},(point){55,20},(point){100,0}};
q[++r]=(tri){(point){100,100},(point){55,20},(point){100,0}};
}
void solve2(){
n-=9;
q[++r]=(tri){(point){0,0},(point){0,100},(point){70,50}};
q[++r]=(tri){(point){0,0},(point){100,0},(point){70,50}};
q[++r]=(tri){(point){100,0},(point){100,60},(point){70,50}};
q[++r]=(tri){(point){0,100},(point){42,70},(point){55,100}};
q[++r]=(tri){(point){42,70},(point){70,75},(point){55,100}};
q[++r]=(tri){(point){42,70},(point){70,75},(point){70,50}};
q[++r]=(tri){(point){100,60},(point){70,75},(point){70,50}};
q[++r]=(tri){(point){100,60},(point){70,75},(point){100,100}};
q[++r]=(tri){(point){55,100},(point){70,75},(point){100,100}};
}
void solve3(){
n-=10;
q[++r]=(tri){(point){0,0},(point){0,100},(point){50,30}};
q[++r]=(tri){(point){100,100},(point){0,100},(point){50,30}};
q[++r]=(tri){(point){100,100},(point){100,0},(point){50,30}};
q[++r]=(tri){(point){0,0},(point){40,0},(point){30,18}};
q[++r]=(tri){(point){100,0},(point){60,0},(point){70,18}};
q[++r]=(tri){(point){30,18},(point){50,14},(point){50,30}};
q[++r]=(tri){(point){30,18},(point){50,14},(point){40,0}};
q[++r]=(tri){(point){60,0},(point){50,14},(point){40,0}};
q[++r]=(tri){(point){60,0},(point){50,14},(point){70,18}};
q[++r]=(tri){(point){50,30},(point){50,14},(point){70,18}};
}
int main(){
n=read();
if(n<=7){
pf("No");
return 0;
}
pf("Yes\n");
if(n%3==2) solve1();
else if(n%3==0) solve2();
else solve3();
fr(i,l,r){
q[i].x=q[i].x*lim;
q[i].y=q[i].y*lim;
q[i].z=q[i].z*lim;
}
while(n){
tri u=q[l];
l++;
point p1=(u.x+u.y)/2,p2=(u.y+u.z)/2,p3=(u.z+u.x)/2;
q[++r]=(tri){u.x,p1,p3};
q[++r]=(tri){p1,u.y,p2};
q[++r]=(tri){p3,p2,u.z};
q[++r]=(tri){p1,p2,p3};
n-=3;
}
fr(i,l,r) q[i].print();
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3548kb
input:
2
output:
No
result:
ok no solution
Test #2:
score: 0
Accepted
time: 1ms
memory: 3424kb
input:
24
output:
Yes 420000000 700000000 700000000 750000000 700000000 500000000 1000000000 600000000 700000000 750000000 700000000 500000000 1000000000 600000000 700000000 750000000 1000000000 1000000000 550000000 1000000000 700000000 750000000 1000000000 1000000000 0 0 0 500000000 350000000 250000000 0 500000000 0...
result:
ok 24 acute triangles
Test #3:
score: 0
Accepted
time: 2ms
memory: 3388kb
input:
1
output:
No
result:
ok no solution
Test #4:
score: 0
Accepted
time: 2ms
memory: 3356kb
input:
3
output:
No
result:
ok no solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
4
output:
No
result:
ok no solution
Test #6:
score: 0
Accepted
time: 2ms
memory: 3364kb
input:
5
output:
No
result:
ok no solution
Test #7:
score: 0
Accepted
time: 2ms
memory: 3472kb
input:
6
output:
No
result:
ok no solution
Test #8:
score: 0
Accepted
time: 2ms
memory: 3432kb
input:
7
output:
No
result:
ok no solution
Test #9:
score: 0
Accepted
time: 4ms
memory: 3420kb
input:
8
output:
Yes 0 0 0 1000000000 450000000 200000000 0 1000000000 500000000 1000000000 450000000 200000000 0 0 500000000 0 450000000 200000000 500000000 1000000000 550000000 200000000 450000000 200000000 500000000 0 550000000 200000000 450000000 200000000 500000000 1000000000 550000000 200000000 1000000000 1000...
result:
ok 8 acute triangles
Test #10:
score: 0
Accepted
time: 2ms
memory: 3536kb
input:
9
output:
Yes 0 0 0 1000000000 700000000 500000000 0 0 1000000000 0 700000000 500000000 1000000000 0 1000000000 600000000 700000000 500000000 0 1000000000 420000000 700000000 550000000 1000000000 420000000 700000000 700000000 750000000 550000000 1000000000 420000000 700000000 700000000 750000000 700000000 500...
result:
ok 9 acute triangles
Test #11:
score: 0
Accepted
time: 2ms
memory: 3536kb
input:
10
output:
Yes 0 0 0 1000000000 500000000 300000000 1000000000 1000000000 0 1000000000 500000000 300000000 1000000000 1000000000 1000000000 0 500000000 300000000 0 0 400000000 0 300000000 180000000 1000000000 0 600000000 0 700000000 180000000 300000000 180000000 500000000 140000000 500000000 300000000 30000000...
result:
ok 10 acute triangles
Test #12:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
11
output:
Yes 0 1000000000 500000000 1000000000 450000000 200000000 0 0 500000000 0 450000000 200000000 500000000 1000000000 550000000 200000000 450000000 200000000 500000000 0 550000000 200000000 450000000 200000000 500000000 1000000000 550000000 200000000 1000000000 1000000000 500000000 0 550000000 20000000...
result:
ok 11 acute triangles
Test #13:
score: 0
Accepted
time: 1ms
memory: 3552kb
input:
12
output:
Yes 0 0 1000000000 0 700000000 500000000 1000000000 0 1000000000 600000000 700000000 500000000 0 1000000000 420000000 700000000 550000000 1000000000 420000000 700000000 700000000 750000000 550000000 1000000000 420000000 700000000 700000000 750000000 700000000 500000000 1000000000 600000000 700000000...
result:
ok 12 acute triangles
Test #14:
score: 0
Accepted
time: 2ms
memory: 3460kb
input:
13
output:
Yes 1000000000 1000000000 0 1000000000 500000000 300000000 1000000000 1000000000 1000000000 0 500000000 300000000 0 0 400000000 0 300000000 180000000 1000000000 0 600000000 0 700000000 180000000 300000000 180000000 500000000 140000000 500000000 300000000 300000000 180000000 500000000 140000000 40000...
result:
ok 13 acute triangles
Test #15:
score: 0
Accepted
time: 2ms
memory: 3704kb
input:
14
output:
Yes 0 0 500000000 0 450000000 200000000 500000000 1000000000 550000000 200000000 450000000 200000000 500000000 0 550000000 200000000 450000000 200000000 500000000 1000000000 550000000 200000000 1000000000 1000000000 500000000 0 550000000 200000000 1000000000 0 1000000000 1000000000 550000000 2000000...
result:
ok 14 acute triangles
Test #16:
score: 0
Accepted
time: 0ms
memory: 3420kb
input:
15
output:
Yes 1000000000 0 1000000000 600000000 700000000 500000000 0 1000000000 420000000 700000000 550000000 1000000000 420000000 700000000 700000000 750000000 550000000 1000000000 420000000 700000000 700000000 750000000 700000000 500000000 1000000000 600000000 700000000 750000000 700000000 500000000 100000...
result:
ok 15 acute triangles
Test #17:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
16
output:
Yes 1000000000 1000000000 1000000000 0 500000000 300000000 0 0 400000000 0 300000000 180000000 1000000000 0 600000000 0 700000000 180000000 300000000 180000000 500000000 140000000 500000000 300000000 300000000 180000000 500000000 140000000 400000000 0 600000000 0 500000000 140000000 400000000 0 6000...
result:
ok 16 acute triangles
Test #18:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
17
output:
Yes 500000000 1000000000 550000000 200000000 450000000 200000000 500000000 0 550000000 200000000 450000000 200000000 500000000 1000000000 550000000 200000000 1000000000 1000000000 500000000 0 550000000 200000000 1000000000 0 1000000000 1000000000 550000000 200000000 1000000000 0 0 0 0 500000000 2250...
result:
ok 17 acute triangles
Test #19:
score: 0
Accepted
time: 2ms
memory: 3488kb
input:
18
output:
Yes 0 1000000000 420000000 700000000 550000000 1000000000 420000000 700000000 700000000 750000000 550000000 1000000000 420000000 700000000 700000000 750000000 700000000 500000000 1000000000 600000000 700000000 750000000 700000000 500000000 1000000000 600000000 700000000 750000000 1000000000 10000000...
result:
ok 18 acute triangles
Test #20:
score: 0
Accepted
time: 2ms
memory: 3700kb
input:
19
output:
Yes 0 0 400000000 0 300000000 180000000 1000000000 0 600000000 0 700000000 180000000 300000000 180000000 500000000 140000000 500000000 300000000 300000000 180000000 500000000 140000000 400000000 0 600000000 0 500000000 140000000 400000000 0 600000000 0 500000000 140000000 700000000 180000000 5000000...
result:
ok 19 acute triangles
Test #21:
score: 0
Accepted
time: 2ms
memory: 3544kb
input:
20
output:
Yes 500000000 0 550000000 200000000 450000000 200000000 500000000 1000000000 550000000 200000000 1000000000 1000000000 500000000 0 550000000 200000000 1000000000 0 1000000000 1000000000 550000000 200000000 1000000000 0 0 0 0 500000000 225000000 100000000 0 500000000 0 1000000000 225000000 600000000 ...
result:
ok 20 acute triangles
Test #22:
score: 0
Accepted
time: 2ms
memory: 3528kb
input:
21
output:
Yes 420000000 700000000 700000000 750000000 550000000 1000000000 420000000 700000000 700000000 750000000 700000000 500000000 1000000000 600000000 700000000 750000000 700000000 500000000 1000000000 600000000 700000000 750000000 1000000000 1000000000 550000000 1000000000 700000000 750000000 1000000000...
result:
ok 21 acute triangles
Test #23:
score: 0
Accepted
time: 1ms
memory: 3484kb
input:
22
output:
Yes 1000000000 0 600000000 0 700000000 180000000 300000000 180000000 500000000 140000000 500000000 300000000 300000000 180000000 500000000 140000000 400000000 0 600000000 0 500000000 140000000 400000000 0 600000000 0 500000000 140000000 700000000 180000000 500000000 300000000 500000000 140000000 700...
result:
ok 22 acute triangles
Test #24:
score: 0
Accepted
time: 1ms
memory: 3756kb
input:
23
output:
Yes 500000000 1000000000 550000000 200000000 1000000000 1000000000 500000000 0 550000000 200000000 1000000000 0 1000000000 1000000000 550000000 200000000 1000000000 0 0 0 0 500000000 225000000 100000000 0 500000000 0 1000000000 225000000 600000000 225000000 100000000 225000000 600000000 450000000 20...
result:
ok 23 acute triangles
Test #25:
score: 0
Accepted
time: 3ms
memory: 3516kb
input:
25
output:
Yes 300000000 180000000 500000000 140000000 500000000 300000000 300000000 180000000 500000000 140000000 400000000 0 600000000 0 500000000 140000000 400000000 0 600000000 0 500000000 140000000 700000000 180000000 500000000 300000000 500000000 140000000 700000000 180000000 0 0 0 500000000 250000000 15...
result:
ok 25 acute triangles
Test #26:
score: 0
Accepted
time: 2ms
memory: 3548kb
input:
26
output:
Yes 500000000 0 550000000 200000000 1000000000 0 1000000000 1000000000 550000000 200000000 1000000000 0 0 0 0 500000000 225000000 100000000 0 500000000 0 1000000000 225000000 600000000 225000000 100000000 225000000 600000000 450000000 200000000 0 500000000 225000000 600000000 225000000 100000000 0 1...
result:
ok 26 acute triangles
Test #27:
score: 0
Accepted
time: 0ms
memory: 3480kb
input:
27
output:
Yes 1000000000 600000000 700000000 750000000 700000000 500000000 1000000000 600000000 700000000 750000000 1000000000 1000000000 550000000 1000000000 700000000 750000000 1000000000 1000000000 0 0 0 500000000 350000000 250000000 0 500000000 0 1000000000 350000000 750000000 350000000 250000000 35000000...
result:
ok 27 acute triangles
Test #28:
score: 0
Accepted
time: 2ms
memory: 3536kb
input:
28
output:
Yes 300000000 180000000 500000000 140000000 400000000 0 600000000 0 500000000 140000000 400000000 0 600000000 0 500000000 140000000 700000000 180000000 500000000 300000000 500000000 140000000 700000000 180000000 0 0 0 500000000 250000000 150000000 0 500000000 0 1000000000 250000000 650000000 2500000...
result:
ok 28 acute triangles
Test #29:
score: 0
Accepted
time: 2ms
memory: 3692kb
input:
29
output:
Yes 1000000000 1000000000 550000000 200000000 1000000000 0 0 0 0 500000000 225000000 100000000 0 500000000 0 1000000000 225000000 600000000 225000000 100000000 225000000 600000000 450000000 200000000 0 500000000 225000000 600000000 225000000 100000000 0 1000000000 250000000 1000000000 225000000 6000...
result:
ok 29 acute triangles
Test #30:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
30
output:
Yes 1000000000 600000000 700000000 750000000 1000000000 1000000000 550000000 1000000000 700000000 750000000 1000000000 1000000000 0 0 0 500000000 350000000 250000000 0 500000000 0 1000000000 350000000 750000000 350000000 250000000 350000000 750000000 700000000 500000000 0 500000000 350000000 7500000...
result:
ok 30 acute triangles
Test #31:
score: 0
Accepted
time: 2ms
memory: 3536kb
input:
31
output:
Yes 600000000 0 500000000 140000000 400000000 0 600000000 0 500000000 140000000 700000000 180000000 500000000 300000000 500000000 140000000 700000000 180000000 0 0 0 500000000 250000000 150000000 0 500000000 0 1000000000 250000000 650000000 250000000 150000000 250000000 650000000 500000000 300000000...
result:
ok 31 acute triangles
Test #32:
score: 0
Accepted
time: 2ms
memory: 3676kb
input:
32
output:
Yes 0 0 0 500000000 225000000 100000000 0 500000000 0 1000000000 225000000 600000000 225000000 100000000 225000000 600000000 450000000 200000000 0 500000000 225000000 600000000 225000000 100000000 0 1000000000 250000000 1000000000 225000000 600000000 250000000 1000000000 500000000 1000000000 4750000...
result:
ok 32 acute triangles
Test #33:
score: 0
Accepted
time: 1ms
memory: 3536kb
input:
33
output:
Yes 550000000 1000000000 700000000 750000000 1000000000 1000000000 0 0 0 500000000 350000000 250000000 0 500000000 0 1000000000 350000000 750000000 350000000 250000000 350000000 750000000 700000000 500000000 0 500000000 350000000 750000000 350000000 250000000 0 0 500000000 0 350000000 250000000 5000...
result:
ok 33 acute triangles
Test #34:
score: 0
Accepted
time: 2ms
memory: 3520kb
input:
34
output:
Yes 600000000 0 500000000 140000000 700000000 180000000 500000000 300000000 500000000 140000000 700000000 180000000 0 0 0 500000000 250000000 150000000 0 500000000 0 1000000000 250000000 650000000 250000000 150000000 250000000 650000000 500000000 300000000 0 500000000 250000000 650000000 250000000 1...
result:
ok 34 acute triangles
Test #35:
score: 0
Accepted
time: 1ms
memory: 3760kb
input:
35
output:
Yes 0 500000000 0 1000000000 225000000 600000000 225000000 100000000 225000000 600000000 450000000 200000000 0 500000000 225000000 600000000 225000000 100000000 0 1000000000 250000000 1000000000 225000000 600000000 250000000 1000000000 500000000 1000000000 475000000 600000000 225000000 600000000 475...
result:
ok 35 acute triangles
Test #36:
score: 0
Accepted
time: 2ms
memory: 3456kb
input:
36
output:
Yes 0 0 0 500000000 350000000 250000000 0 500000000 0 1000000000 350000000 750000000 350000000 250000000 350000000 750000000 700000000 500000000 0 500000000 350000000 750000000 350000000 250000000 0 0 500000000 0 350000000 250000000 500000000 0 1000000000 0 850000000 250000000 350000000 250000000 85...
result:
ok 36 acute triangles
Test #37:
score: 0
Accepted
time: 2ms
memory: 3484kb
input:
37
output:
Yes 500000000 300000000 500000000 140000000 700000000 180000000 0 0 0 500000000 250000000 150000000 0 500000000 0 1000000000 250000000 650000000 250000000 150000000 250000000 650000000 500000000 300000000 0 500000000 250000000 650000000 250000000 150000000 1000000000 1000000000 500000000 1000000000 ...
result:
ok 37 acute triangles
Test #38:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
38
output:
Yes 225000000 100000000 225000000 600000000 450000000 200000000 0 500000000 225000000 600000000 225000000 100000000 0 1000000000 250000000 1000000000 225000000 600000000 250000000 1000000000 500000000 1000000000 475000000 600000000 225000000 600000000 475000000 600000000 450000000 200000000 25000000...
result:
ok 38 acute triangles
Test #39:
score: 0
Accepted
time: 2ms
memory: 3452kb
input:
39
output:
Yes 0 500000000 0 1000000000 350000000 750000000 350000000 250000000 350000000 750000000 700000000 500000000 0 500000000 350000000 750000000 350000000 250000000 0 0 500000000 0 350000000 250000000 500000000 0 1000000000 0 850000000 250000000 350000000 250000000 850000000 250000000 700000000 50000000...
result:
ok 39 acute triangles
Test #40:
score: 0
Accepted
time: 2ms
memory: 3700kb
input:
40
output:
Yes 0 0 0 500000000 250000000 150000000 0 500000000 0 1000000000 250000000 650000000 250000000 150000000 250000000 650000000 500000000 300000000 0 500000000 250000000 650000000 250000000 150000000 1000000000 1000000000 500000000 1000000000 750000000 650000000 500000000 1000000000 0 1000000000 250000...
result:
ok 40 acute triangles
Test #41:
score: 0
Accepted
time: 2ms
memory: 3704kb
input:
41
output:
Yes 0 500000000 225000000 600000000 225000000 100000000 0 1000000000 250000000 1000000000 225000000 600000000 250000000 1000000000 500000000 1000000000 475000000 600000000 225000000 600000000 475000000 600000000 450000000 200000000 250000000 1000000000 475000000 600000000 225000000 600000000 0 0 250...
result:
ok 41 acute triangles
Test #42:
score: 0
Accepted
time: 1ms
memory: 3456kb
input:
42
output:
Yes 350000000 250000000 350000000 750000000 700000000 500000000 0 500000000 350000000 750000000 350000000 250000000 0 0 500000000 0 350000000 250000000 500000000 0 1000000000 0 850000000 250000000 350000000 250000000 850000000 250000000 700000000 500000000 500000000 0 850000000 250000000 350000000 2...
result:
ok 42 acute triangles
Test #43:
score: 0
Accepted
time: 2ms
memory: 3460kb
input:
43
output:
Yes 0 500000000 0 1000000000 250000000 650000000 250000000 150000000 250000000 650000000 500000000 300000000 0 500000000 250000000 650000000 250000000 150000000 1000000000 1000000000 500000000 1000000000 750000000 650000000 500000000 1000000000 0 1000000000 250000000 650000000 750000000 650000000 25...
result:
ok 43 acute triangles
Test #44:
score: -100
Wrong Answer
time: 2ms
memory: 3556kb
input:
44
output:
Yes 0 1000000000 250000000 1000000000 225000000 600000000 250000000 1000000000 500000000 1000000000 475000000 600000000 225000000 600000000 475000000 600000000 450000000 200000000 250000000 1000000000 475000000 600000000 225000000 600000000 0 0 250000000 0 225000000 100000000 250000000 0 500000000 0...
result:
wrong answer triangle 43 not acute