QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#740934#7680. Subwayrqoi031WA 0ms1528kbC++201.2kb2024-11-13 12:31:372024-11-13 12:31:38

Judging History

你现在查看的是最新测评结果

  • [2024-11-13 12:31:38]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1528kb
  • [2024-11-13 12:31:37]
  • 提交

answer

#include<stdio.h>
#include<algorithm>
typedef long long ll;
constexpr int dx{2},dy{10007};
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]={1001,1001,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)*(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);
        }
        printf("%d %d\n",b[n].x,b[n].y);
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 1528kb

input:

3
1 2 1
2 1 2
3 3 2

output:

2
5 2 1 5001 -2 1 2 5002 -3 3 3
5 2 1 5001 -2 10008 0 5002 -3 3 3

result:

wrong answer Self-intersecting polyline 1.