QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#741774#7680. Subwayrqoi031WA 0ms1632kbC++201.2kb2024-11-13 15:12:062024-11-13 15:12:08

Judging History

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

  • [2024-11-13 15:12:08]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1632kb
  • [2024-11-13 15:12:06]
  • 提交

answer

#include<stdio.h>
#include<algorithm>
typedef long long ll;
constexpr int dx{1},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);
    }
    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);
        for(int i=1;i<=n;i++) {
            printf("%d %d ",b[i].x,b[i].y);
            printf("%d %d%c",c[i].x,c[i].y,i==n?'\n':' ');
            c[i].x+=dy,c[i].y-=dx;
        }
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 1632kb

input:

3
1 2 1
2 1 2
3 3 2

output:

2
6 2 1 3 1 1 2 2 2 3 3 4 3
6 2 1 10010 0 10008 1 10009 1 3 3 10011 2

result:

ok ok Sum L = 12

Test #2:

score: 0
Accepted
time: 0ms
memory: 1528kb

input:

1
1 1 1

output:

1
2 1 1 2 1

result:

ok ok Sum L = 2

Test #3:

score: 0
Accepted
time: 0ms
memory: 1528kb

input:

1
1 1 50

output:

50
2 1 1 2 1
2 1 1 10009 0
2 1 1 20016 -1
2 1 1 30023 -2
2 1 1 40030 -3
2 1 1 50037 -4
2 1 1 60044 -5
2 1 1 70051 -6
2 1 1 80058 -7
2 1 1 90065 -8
2 1 1 100072 -9
2 1 1 110079 -10
2 1 1 120086 -11
2 1 1 130093 -12
2 1 1 140100 -13
2 1 1 150107 -14
2 1 1 160114 -15
2 1 1 170121 -16
2 1 1 180128 -17
2...

result:

ok ok Sum L = 100

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 1608kb

input:

50
662 -567 48
728 -120 7
307 669 27
-885 -775 21
100 242 9
-784 -537 41
940 198 46
736 -551 30
-449 456 16
-945 382 18
-182 810 49
213 187 44
853 245 48
617 -305 19
-81 261 3
617 208 8
-548 -652 6
-888 -667 14
-371 -812 43
202 -702 10
-668 -725 5
961 -919 33
-870 -697 50
428 810 29
560 405 7
348 -3...

output:

50
100 961 -919 -9045 -918 -306 -897 -305 -897 334 -893 -9672 -892 -371 -812 -370 -812 -885 -775 -884 -775 -668 -725 -667 -725 -462 -719 -461 -719 202 -702 -9804 -701 -870 -697 -869 -697 -888 -667 -887 -667 -548 -652 -547 -652 662 -567 -9344 -566 736 -551 -9270 -550 -784 -537 -783 -537 -579 -437 -57...

result:

wrong answer Polyline 3 intersects with previous polylines.