QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#310378 | #5419. Triangles | sumi007 | WA | 0ms | 3736kb | C++14 | 2.3kb | 2024-01-21 12:04:05 | 2024-01-21 12:04:06 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define ldb long double
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define lowbit(i) i&(-i)
const int N = 2077,lim = 1e7;
int n,l,r;
struct Point{
int x,y;
friend Point operator + (Point a,Point b){
return {a.x+b.x,a.y+b.y};
}
friend Point operator / (Point a,int k){
return {a.x/k,a.y/k};
}
friend Point operator * (Point a,int k){
return {a.x*k,a.y*k};
}
};
struct Tri{
Point a,b,c;
}q[N];
int main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin >> n;
if(n<8){
cout << "No\n";
return 0;
}
l = 1,r = 0;
cout << "Yes\n";
if(n%3==0){
n -= 9;
q[++r] = {{0,100},{42,70},{55,100}};
q[++r] = {{0,100},{70,50},{0,0}};
q[++r] = {{0,0},{70,50},{100,0}};
q[++r] = {{100,0},{70,50},{100,60}};
q[++r] = {{100,60},{70,75},{100,100}};
q[++r] = {{100,100},{55,100},{70,75}};
q[++r] = {{55,100},{70,75},{42,70}};
q[++r] = {{42,70},{70,50},{70,75}};
q[++r] = {{70,50},{100,60},{70,75}};
}else if(n%3==1){
n -= 10;
q[++r] = {{0,0},{40,0},{30,18}};
q[++r] = {{30,18},{50,14},{40,0}};
q[++r] = {{40,0},{50,14},{60,0}};
q[++r] = {{60,0},{50,14},{70,18}};
q[++r] = {{60,0},{70,18},{100,0}};
q[++r] = {{30,18},{50,14},{50,30}};
q[++r] = {{50,30},{70,18},{50,14}};
q[++r] = {{0,0},{50,30},{0,100}};
q[++r] = {{0,100},{100,100},{50,30}};
q[++r] = {{100,100},{50,30},{100,0}};
}else if(n%3==2){
n -= 8;
q[++r] = {{0,0},{45,20},{50,0}};
q[++r] = {{45,20},{50,0},{55,20}};
q[++r] = {{50,0},{55,20},{100,0}};
q[++r] = {{0,0},{100,0},{45,20}};
q[++r] = {{100,0},{45,20},{55,100}};
q[++r] = {{50,100},{45,20},{55,20}};
q[++r] = {{50,100},{100,100},{55,20}};
q[++r] = {{100,100},{55,20},{100,0}};
}
for(int i=l;i<=r;i++){
q[i].a = q[i].a*lim;
q[i].b = q[i].b*lim;
q[i].c = q[i].c*lim;
}
while(n){
n-=3;
auto hd = q[l];l++;
Point ma=(hd.a+hd.b)/2,mb=(hd.b+hd.c)/2,mc=(hd.a+hd.c)/2;
q[++r] = {ma,mb,mc};
q[++r] = {hd.a,ma,mc};
q[++r] = {hd.b,mb,ma};
q[++r] = {hd.c,mb,mc};
}
for(int i=l;i<=r;i++){
cout << q[i].a.x << ' ' << q[i].a.y << ' ';
cout << q[i].b.x << ' ' << q[i].b.y << ' ';
cout << q[i].c.x << ' ' << q[i].c.y << "\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3640kb
input:
2
output:
No
result:
ok no solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
24
output:
Yes 1000000000 1000000000 550000000 1000000000 700000000 750000000 550000000 1000000000 700000000 750000000 420000000 700000000 420000000 700000000 700000000 500000000 700000000 750000000 700000000 500000000 1000000000 600000000 700000000 750000000 210000000 850000000 485000000 850000000 275000000 1...
result:
ok 24 acute triangles
Test #3:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
1
output:
No
result:
ok no solution
Test #4:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
3
output:
No
result:
ok no solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
4
output:
No
result:
ok no solution
Test #6:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
5
output:
No
result:
ok no solution
Test #7:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
6
output:
No
result:
ok no solution
Test #8:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
7
output:
No
result:
ok no solution
Test #9:
score: -100
Wrong Answer
time: 0ms
memory: 3596kb
input:
8
output:
Yes 0 0 450000000 200000000 500000000 0 450000000 200000000 500000000 0 550000000 200000000 500000000 0 550000000 200000000 1000000000 0 0 0 1000000000 0 450000000 200000000 1000000000 0 450000000 200000000 550000000 1000000000 500000000 1000000000 450000000 200000000 550000000 200000000 500000000 1...
result:
wrong answer triangle 4 not acute