QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#741796 | #7680. Subway | rqoi031 | WA | 0ms | 1648kb | C++20 | 1.2kb | 2024-11-13 15:14:13 | 2024-11-13 15:14:17 |
Judging History
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],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 i=1;i<=n;i++) {
if(a[i].c) {
--a[i].c;
}
else {
a[i].x+=dy,a[i].y-=dx;
}
}
printf("%d ",n*2);
for(int i=1;i<=n;i++) {
printf("%d %d ",a[i].x,a[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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 1648kb
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: 1580kb
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: 1536kb
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: 0
Accepted
time: 0ms
memory: 1548kb
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:
ok ok Sum L = 5000
Test #5:
score: 0
Accepted
time: 0ms
memory: 1612kb
input:
50 -772 697 1 -756 -909 1 659 923 1 850 471 1 260 -24 1 473 -639 1 -575 393 1 -466 197 1 333 -637 1 -192 -890 1 103 546 1 749 -723 1 -573 613 1 214 -138 1 277 928 1 266 291 1 911 275 1 -680 -67 1 69 190 1 -197 -795 1 684 618 1 729 -115 1 -658 -229 1 -595 -470 1 898 -172 1 401 81 1 133 685 1 223 400 ...
output:
1 100 -162 -959 -161 -959 -756 -909 -755 -909 -192 -890 -191 -890 30 -869 -9976 -868 -197 -795 -196 -795 749 -723 -9257 -722 -571 -716 -570 -716 -216 -711 -215 -711 -273 -672 -272 -672 473 -639 -9533 -638 333 -637 -9673 -636 360 -630 -9646 -629 -135 -509 -134 -509 -595 -470 -594 -470 115 -235 -9891 ...
result:
ok ok Sum L = 100
Test #6:
score: 0
Accepted
time: 0ms
memory: 1632kb
input:
50 -56 747 3 993 -490 4 930 -139 1 -298 -330 1 938 -351 5 -973 100 5 -472 44 4 345 628 5 481 -91 4 789 581 5 457 -29 4 871 -799 1 692 994 4 699 854 2 893 -33 1 -483 256 3 -962 -540 2 846 -893 1 830 609 5 845 -383 2 -552 -966 1 -544 -51 1 564 186 4 -615 -675 1 618 -911 3 -561 -302 4 -293 667 3 -334 -...
output:
5 100 356 -986 -9650 -985 348 -975 -9658 -974 -552 -966 -551 -966 618 -911 -9388 -910 846 -893 -9160 -892 594 -847 -9412 -846 674 -804 -9332 -803 -637 -801 -636 -801 871 -799 -9135 -798 17 -757 -9989 -756 -615 -675 -614 -675 840 -638 -9166 -637 -792 -625 -791 -625 -888 -613 -887 -613 -962 -540 -961 ...
result:
ok ok Sum L = 500
Test #7:
score: 0
Accepted
time: 0ms
memory: 1540kb
input:
50 600 997 5 -893 -204 3 408 443 1 -560 -748 7 -647 161 6 -285 -980 1 87 -582 7 -48 -721 7 997 285 2 -189 -728 8 525 222 4 -324 816 9 760 317 3 753 -480 10 -813 -921 3 -325 -875 8 -747 816 10 -627 605 7 775 786 6 136 -54 2 274 948 10 216 -113 7 924 68 3 101 576 8 60 -501 2 898 801 8 -767 -974 10 -99...
output:
10 100 -313 -996 -312 -996 -285 -980 -284 -980 -767 -974 -766 -974 932 -941 -9074 -940 -258 -938 -257 -938 -813 -921 -812 -921 -325 -875 -324 -875 -19 -845 -18 -845 166 -766 -9840 -765 -560 -748 -559 -748 -397 -741 -396 -741 -189 -728 -188 -728 -48 -721 -47 -721 269 -705 -9737 -704 326 -644 -9680 -6...
result:
ok ok Sum L = 1000
Test #8:
score: 0
Accepted
time: 0ms
memory: 1528kb
input:
50 24 -889 49 117 418 49 25 524 44 980 -416 43 -494 357 41 -287 -285 46 151 574 41 -289 68 49 -515 -540 41 -367 -178 47 -887 151 45 197 -272 47 714 724 45 -737 94 49 810 830 47 808 -695 41 537 -637 49 -142 -167 44 -749 -631 47 445 -444 42 801 910 43 59 363 42 -912 466 50 -649 -479 48 -958 -511 49 88...
output:
50 100 75 -958 -9931 -957 -282 -917 -281 -917 24 -889 -9982 -888 173 -857 -9833 -856 273 -830 -9733 -829 808 -695 -9198 -694 537 -637 -9469 -636 -749 -631 -748 -631 938 -596 -9068 -595 -515 -540 -514 -540 -958 -511 -957 -511 -649 -479 -648 -479 139 -450 -9867 -449 531 -449 -9475 -448 445 -444 -9561 ...
result:
ok ok Sum L = 5000
Test #9:
score: 0
Accepted
time: 0ms
memory: 1540kb
input:
50 151 -171 50 -367 -951 50 808 569 50 150 -618 50 27 -476 50 -846 729 50 549 -456 50 50 646 50 294 -70 50 -571 104 50 128 -265 50 913 -700 50 267 -965 50 896 846 50 -2 713 50 21 679 50 -515 975 50 168 180 50 -369 -98 50 676 115 50 643 -779 50 920 -237 50 -324 450 50 149 -378 50 -882 -602 50 -126 -7...
output:
50 100 -302 -989 -301 -989 267 -965 -9739 -964 -367 -951 -366 -951 417 -944 -9589 -943 197 -923 -9809 -922 481 -873 -9525 -872 -126 -799 -125 -799 643 -779 -9363 -778 913 -700 -9093 -699 498 -636 -9508 -635 150 -618 -9856 -617 -882 -602 -881 -602 895 -564 -9111 -563 27 -476 -9979 -475 421 -463 -9585...
result:
ok ok Sum L = 5000
Test #10:
score: -100
Wrong Answer
time: 0ms
memory: 1576kb
input:
50 4 5 34 1 -5 24 -4 -4 32 -3 3 28 0 -1 21 1 -4 25 0 0 30 0 -4 42 -3 -2 44 -5 -3 37 4 -1 46 5 2 20 2 2 37 -2 5 35 -2 -1 39 2 4 32 -4 -3 42 0 3 32 3 5 47 -4 1 2 5 -1 17 -5 -4 5 -2 2 29 -5 1 11 2 -5 43 4 4 14 -5 0 9 0 -5 17 5 1 27 -3 0 24 -1 4 16 5 0 50 3 -2 18 1 -2 6 2 -1 29 -1 3 38 1 5 36 -3 1 28 -3...
output:
50 100 -2 -5 -1 -5 0 -5 -10006 -4 1 -5 -10005 -4 2 -5 -10004 -4 -5 -4 -4 -4 -4 -4 -3 -4 -1 -4 0 -4 0 -4 -10006 -3 1 -4 -10005 -3 5 -4 -10001 -3 -5 -3 -4 -3 -4 -3 -3 -3 -3 -3 -2 -3 0 -3 -10006 -2 2 -3 -10004 -2 -3 -2 -2 -2 0 -2 -10006 -1 1 -2 -10005 -1 3 -2 -10003 -1 -3 -1 -2 -1 -2 -1 -1 -1 0 -1 -100...
result:
wrong answer Duplicated points on polyline 1.