QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#310366 | #5419. Triangles | sumi007 | WA | 1ms | 3636kb | C++14 | 2.3kb | 2024-01-21 11:54:35 | 2024-01-21 11:54:36 |
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},{40,25},{50,0}};
q[++r] = {{40,25},{50,0},{60,25}};
q[++r] = {{50,0},{60,25},{100,0}};
q[++r] = {{0,0},{100,0},{40,25}};
q[++r] = {{100,0},{40,25},{50,100}};
q[++r] = {{50,100},{40,25},{60,25}};
q[++r] = {{50,100},{100,100},{60,25}};
q[++r] = {{100,100},{60,25},{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--;
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: 1ms
memory: 3616kb
input:
2
output:
No
result:
ok no solution
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3636kb
input:
24
output:
Yes 700000000 500000000 350000000 250000000 350000000 750000000 0 0 350000000 250000000 0 500000000 350000000 250000000 850000000 250000000 500000000 0 0 0 350000000 250000000 500000000 0 700000000 500000000 850000000 250000000 350000000 250000000 1000000000 0 850000000 250000000 500000000 0 8500000...
result:
wrong answer total area 5500000000000000000/2, not 1e18