QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#741764 | #7680. Subway | rqoi031 | WA | 0ms | 1612kb | C++20 | 1.3kb | 2024-11-13 15:10:58 | 2024-11-13 15:10:59 |
Judging History
answer
#include<stdio.h>
#include<algorithm>
typedef long long ll;
constexpr int dx{1},dy{3};
struct point {
int x,y,c;
constexpr int eval() const {
return x*dx+y*dy;
}
};
point a[55],b[55],c[55];
int main() {
int n;
scanf("%d",&n);
int m(0);
for(int i=1;i<=n;i++) {
scanf("%d%d%d",&a[i].x,&a[i].y,&a[i].c);
m=std::max(m,a[i].c);
}
if(n==1) {
a[++n]={11,11,m};
}
std::sort(a+1,a+n+1,[&](const point &x,const point &y)->bool {
return x.eval()<y.eval();
});
for(int i=1;i<n;i++) {
const int v0(a[i].eval());
ll x(ll(dy/dx+1)*(v0+1)),y(-v0-1);
const ll k(x/dy);
x-=k*dy,y+=k*dx;
c[i]={int(x),int(y),0};
}
printf("%d\n",m);
for(int i=1;i<=m;i++) {
for(int j=1;j<=n;j++) {
if(a[j].c) {
b[j]=a[j],--a[j].c;
}
else {
b[j]={a[j].x+dy,a[j].y-dx,0};
}
}
printf("%d ",n*2-1);
for(int i=1;i<n;i++) {
printf("%d %d ",b[i].x,b[i].y);
printf("%d %d ",c[i].x,c[i].y);
c[i].x+=dy,c[i].y-=dx;
}
printf("%d %d\n",b[n].x,b[n].y);
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 1592kb
input:
3 1 2 1 2 1 2 3 3 2
output:
2 5 2 1 0 2 1 2 2 2 3 3 5 2 1 3 1 4 1 5 1 3 3
result:
ok ok Sum L = 10
Test #2:
score: 0
Accepted
time: 0ms
memory: 1612kb
input:
1 1 1 1
output:
1 3 1 1 2 1 11 11
result:
ok ok Sum L = 3
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 1608kb
input:
1 1 1 50
output:
50 3 1 1 2 1 11 11 3 1 1 5 0 11 11 3 1 1 8 -1 11 11 3 1 1 11 -2 11 11 3 1 1 14 -3 11 11 3 1 1 17 -4 11 11 3 1 1 20 -5 11 11 3 1 1 23 -6 11 11 3 1 1 26 -7 11 11 3 1 1 29 -8 11 11 3 1 1 32 -9 11 11 3 1 1 35 -10 11 11 3 1 1 38 -11 11 11 3 1 1 41 -12 11 11 3 1 1 44 -13 11 11 3 1 1 47 -14 11 11 3 1 1 50 ...
result:
wrong answer Polyline 2 intersects with previous polylines.