QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#741804 | #7680. Subway | rqoi031 | AC ✓ | 0ms | 1648kb | C++20 | 1.2kb | 2024-11-13 15:15:19 | 2024-11-13 15:15:19 |
Judging History
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],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;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 1608kb
input:
3 1 2 1 2 1 2 3 3 2
output:
2 6 2 1 5006 0 1 2 5005 1 3 3 5007 2 6 2 1 15013 -2 10008 0 15012 -1 3 3 15014 0
result:
ok ok Sum L = 12
Test #2:
score: 0
Accepted
time: 0ms
memory: 1600kb
input:
1 1 1 1
output:
1 2 1 1 5005 0
result:
ok ok Sum L = 2
Test #3:
score: 0
Accepted
time: 0ms
memory: 1640kb
input:
1 1 1 50
output:
50 2 1 1 5005 0 2 1 1 15012 -2 2 1 1 25019 -4 2 1 1 35026 -6 2 1 1 45033 -8 2 1 1 55040 -10 2 1 1 65047 -12 2 1 1 75054 -14 2 1 1 85061 -16 2 1 1 95068 -18 2 1 1 105075 -20 2 1 1 115082 -22 2 1 1 125089 -24 2 1 1 135096 -26 2 1 1 145103 -28 2 1 1 155110 -30 2 1 1 165117 -32 2 1 1 175124 -34 2 1 1 18...
result:
ok ok Sum L = 100
Test #4:
score: 0
Accepted
time: 0ms
memory: 1640kb
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 -4042 -918 -306 -897 -5309 -896 334 -893 -4669 -892 -371 -812 -5374 -811 -885 -775 -5888 -774 -668 -725 -5671 -724 -462 -719 -5465 -718 202 -702 -4801 -701 -870 -697 -5873 -696 -888 -667 -5891 -666 -548 -652 -5551 -651 662 -567 -4341 -566 736 -551 -4267 -550 -784 -537 -5787 -536 -579...
result:
ok ok Sum L = 5000
Test #5:
score: 0
Accepted
time: 0ms
memory: 1648kb
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 -5165 -958 -756 -909 -5759 -908 -192 -890 -5195 -889 30 -869 -4973 -868 -197 -795 -5200 -794 749 -723 -4254 -722 -571 -716 -5574 -715 -216 -711 -5219 -710 -273 -672 -5276 -671 473 -639 -4530 -638 333 -637 -4670 -636 360 -630 -4643 -629 -135 -509 -5138 -508 -595 -470 -5598 -469 115 -2...
result:
ok ok Sum L = 100
Test #6:
score: 0
Accepted
time: 0ms
memory: 1536kb
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 -4647 -985 348 -975 -4655 -974 -552 -966 -5555 -965 618 -911 -4385 -910 846 -893 -4157 -892 594 -847 -4409 -846 674 -804 -4329 -803 -637 -801 -5640 -800 871 -799 -4132 -798 17 -757 -4986 -756 -615 -675 -5618 -674 840 -638 -4163 -637 -792 -625 -5795 -624 -888 -613 -5891 -612 -962 -540 ...
result:
ok ok Sum L = 500
Test #7:
score: 0
Accepted
time: 0ms
memory: 1624kb
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 -5316 -995 -285 -980 -5288 -979 -767 -974 -5770 -973 932 -941 -4071 -940 -258 -938 -5261 -937 -813 -921 -5816 -920 -325 -875 -5328 -874 -19 -845 -5022 -844 166 -766 -4837 -765 -560 -748 -5563 -747 -397 -741 -5400 -740 -189 -728 -5192 -727 -48 -721 -5051 -720 269 -705 -4734 -704 326 ...
result:
ok ok Sum L = 1000
Test #8:
score: 0
Accepted
time: 0ms
memory: 1632kb
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 -4928 -957 -282 -917 -5285 -916 24 -889 -4979 -888 173 -857 -4830 -856 273 -830 -4730 -829 808 -695 -4195 -694 537 -637 -4466 -636 -749 -631 -5752 -630 938 -596 -4065 -595 -515 -540 -5518 -539 -958 -511 -5961 -510 -649 -479 -5652 -478 139 -450 -4864 -449 531 -449 -4472 -448 445 -444 -...
result:
ok ok Sum L = 5000
Test #9:
score: 0
Accepted
time: 0ms
memory: 1572kb
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 -5305 -988 267 -965 -4736 -964 -367 -951 -5370 -950 417 -944 -4586 -943 197 -923 -4806 -922 481 -873 -4522 -872 -126 -799 -5129 -798 643 -779 -4360 -778 913 -700 -4090 -699 498 -636 -4505 -635 150 -618 -4853 -617 -882 -602 -5885 -601 895 -564 -4108 -563 27 -476 -4976 -475 421 -463 -...
result:
ok ok Sum L = 5000
Test #10:
score: 0
Accepted
time: 0ms
memory: 1536kb
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 -5005 -4 0 -5 -5003 -4 1 -5 -5002 -4 2 -5 -5001 -4 -5 -4 -5008 -3 -4 -4 -5007 -3 -1 -4 -5004 -3 0 -4 -5003 -3 1 -4 -5002 -3 5 -4 -4998 -3 -5 -3 -5008 -2 -4 -3 -5007 -2 -3 -3 -5006 -2 0 -3 -5003 -2 2 -3 -5001 -2 -3 -2 -5006 -1 0 -2 -5003 -1 1 -2 -5002 -1 3 -2 -5000 -1 -3 -1 -5006 0 -2 -1...
result:
ok ok Sum L = 5000
Test #11:
score: 0
Accepted
time: 0ms
memory: 1556kb
input:
50 2 0 2 2 -3 2 4 1 2 -3 -3 2 -5 1 2 5 3 2 -5 -3 2 -3 -2 2 2 -1 2 2 3 2 4 4 1 1 -4 1 5 -1 2 -4 1 2 3 -2 1 -1 2 2 5 -5 2 -2 1 2 -5 -1 2 -2 -1 2 -1 -2 2 5 5 1 0 -2 2 1 1 1 2 2 2 3 5 2 -2 -4 1 -3 5 1 4 2 2 -4 -4 2 -3 2 1 5 0 2 -2 -2 2 -4 4 1 -2 5 2 2 5 1 3 -5 2 -4 5 2 -5 5 2 -2 4 2 -5 -5 2 -2 2 2 -3 -4...
output:
2 100 -5 -5 -5008 -4 3 -5 -5000 -4 5 -5 -4998 -4 -4 -4 -5007 -3 -3 -4 -5006 -3 -2 -4 -5005 -3 -1 -4 -5004 -3 1 -4 -5002 -3 2 -4 -5001 -3 -5 -3 -5008 -2 -3 -3 -5006 -2 2 -3 -5001 -2 3 -3 -5000 -2 -3 -2 -5006 -1 -2 -2 -5005 -1 -1 -2 -5004 -1 0 -2 -5003 -1 1 -2 -5002 -1 2 -2 -5001 -1 3 -2 -5000 -1 -5 -...
result:
ok ok Sum L = 200
Test #12:
score: 0
Accepted
time: 0ms
memory: 1624kb
input:
50 4 3 49 -5 -3 49 0 -3 50 -2 -4 49 -5 -5 50 4 0 49 -1 -2 49 -2 0 49 1 2 50 -1 -5 50 -5 -1 50 -5 5 49 2 0 50 -2 -3 50 -4 -5 50 0 -2 50 -5 4 50 -1 1 49 -1 -4 49 -3 -1 49 1 -3 50 -4 1 50 0 5 50 1 -2 50 -1 5 50 4 2 50 4 -3 49 1 -4 49 -1 -1 49 -3 -5 50 4 -4 50 3 2 49 3 -3 49 0 2 50 -3 -4 49 5 -1 49 -3 5...
output:
50 100 -5 -5 -5008 -4 -4 -5 -5007 -4 -3 -5 -5006 -4 -1 -5 -5004 -4 1 -5 -5002 -4 2 -5 -5001 -4 -3 -4 -5006 -3 -2 -4 -5005 -3 -1 -4 -5004 -3 0 -4 -5003 -3 1 -4 -5002 -3 4 -4 -4999 -3 -5 -3 -5008 -2 -2 -3 -5005 -2 0 -3 -5003 -2 1 -3 -5002 -2 3 -3 -5000 -2 4 -3 -4999 -2 5 -3 -4998 -2 -1 -2 -5004 -1 0 -...
result:
ok ok Sum L = 5000
Test #13:
score: 0
Accepted
time: 0ms
memory: 1628kb
input:
50 114 514 30 115 514 41 116 514 6 117 514 49 118 514 10 119 514 49 120 514 1 121 514 7 122 514 3 123 514 4 124 514 1 125 514 12 126 514 15 127 514 16 128 514 34 129 514 24 130 514 49 131 514 43 132 514 25 133 514 12 134 514 26 135 514 13 136 514 12 137 514 15 138 514 7 139 514 25 140 514 5 141 514 ...
output:
49 100 114 514 5118 513 115 514 5119 513 116 514 5120 513 117 514 5121 513 118 514 5122 513 119 514 5123 513 120 514 5124 513 121 514 5125 513 122 514 5126 513 123 514 5127 513 124 514 5128 513 125 514 5129 513 126 514 5130 513 127 514 5131 513 128 514 5132 513 129 514 5133 513 130 514 5134 513 131 ...
result:
ok ok Sum L = 4900
Test #14:
score: 0
Accepted
time: 0ms
memory: 1604kb
input:
50 191 981 19 191 980 41 191 979 20 191 978 14 191 977 2 191 976 49 191 975 40 191 974 3 191 973 20 191 972 6 191 971 13 191 970 4 191 969 4 191 968 47 191 967 32 191 966 11 191 965 34 191 964 30 191 963 3 191 962 16 191 961 24 191 960 30 191 959 34 191 958 31 191 957 24 191 956 29 191 955 42 191 95...
output:
49 100 191 932 5195 931 191 933 5195 932 191 934 5195 933 191 935 5195 934 191 936 5195 935 191 937 5195 936 191 938 5195 937 191 939 5195 938 191 940 5195 939 191 941 5195 940 191 942 5195 941 191 943 5195 942 191 944 5195 943 191 945 5195 944 191 946 5195 945 191 947 5195 946 191 948 5195 947 191 ...
result:
ok ok Sum L = 4900
Test #15:
score: 0
Accepted
time: 0ms
memory: 1580kb
input:
50 -123 456 47 -122 457 35 -121 458 25 -120 459 35 -119 460 30 -118 461 33 -117 462 21 -116 463 31 -115 464 21 -114 465 35 -113 466 20 -112 467 17 -111 468 25 -110 469 3 -109 470 29 -108 471 35 -107 472 4 -106 473 44 -105 474 4 -104 475 28 -103 476 49 -102 477 9 -101 478 39 -100 479 9 -99 480 21 -98...
output:
50 100 -123 456 4881 455 -122 457 4882 456 -121 458 4883 457 -120 459 4884 458 -119 460 4885 459 -118 461 4886 460 -117 462 4887 461 -116 463 4888 462 -115 464 4889 463 -114 465 4890 464 -113 466 4891 465 -112 467 4892 466 -111 468 4893 467 -110 469 4894 468 -109 470 4895 469 -108 471 4896 470 -107 ...
result:
ok ok Sum L = 5000
Test #16:
score: 0
Accepted
time: 0ms
memory: 1532kb
input:
50 321 -525 46 322 -526 14 323 -527 16 324 -528 38 325 -529 22 326 -530 24 327 -531 48 328 -532 5 329 -533 7 330 -534 30 331 -535 25 332 -536 2 333 -537 13 334 -538 1 335 -539 33 336 -540 8 337 -541 9 338 -542 2 339 -543 29 340 -544 17 341 -545 41 342 -546 39 343 -547 9 344 -548 47 345 -549 47 346 -...
output:
50 100 370 -574 -4633 -573 369 -573 -4634 -572 368 -572 -4635 -571 367 -571 -4636 -570 366 -570 -4637 -569 365 -569 -4638 -568 364 -568 -4639 -567 363 -567 -4640 -566 362 -566 -4641 -565 361 -565 -4642 -564 360 -564 -4643 -563 359 -563 -4644 -562 358 -562 -4645 -561 357 -561 -4646 -560 356 -560 -464...
result:
ok ok Sum L = 5000
Test #17:
score: 0
Accepted
time: 0ms
memory: 1604kb
input:
50 -444 -555 23 -445 -556 32 -446 -557 36 -447 -558 29 -448 -559 4 -449 -560 25 -450 -561 29 -451 -562 5 -452 -563 9 -453 -564 28 -454 -565 35 -455 -566 26 -456 -567 22 -457 -568 39 -458 -569 13 -459 -570 50 -460 -571 37 -461 -572 14 -462 -573 26 -463 -574 49 -464 -575 23 -465 -576 44 -466 -577 2 -4...
output:
50 100 -493 -604 -5496 -603 -492 -603 -5495 -602 -491 -602 -5494 -601 -490 -601 -5493 -600 -489 -600 -5492 -599 -488 -599 -5491 -598 -487 -598 -5490 -597 -486 -597 -5489 -596 -485 -596 -5488 -595 -484 -595 -5487 -594 -483 -594 -5486 -593 -482 -593 -5485 -592 -481 -592 -5484 -591 -480 -591 -5483 -590...
result:
ok ok Sum L = 5000
Test #18:
score: 0
Accepted
time: 0ms
memory: 1632kb
input:
50 -142 0 48 -143 1 22 -144 2 45 -145 3 9 -146 4 36 -147 5 46 -148 6 26 -149 7 26 -150 8 9 -151 9 19 -152 10 22 -153 11 14 -154 12 8 -155 13 20 -156 14 41 -157 15 47 -158 16 22 -159 17 50 -160 18 3 -161 19 12 -162 20 15 -163 21 32 -164 22 46 -165 23 45 -166 24 3 -167 25 27 -168 26 33 -169 27 17 -170...
output:
50 100 -142 0 -5145 1 -143 1 4861 0 -144 2 4860 1 -145 3 4859 2 -146 4 4858 3 -147 5 4857 4 -148 6 4856 5 -149 7 4855 6 -150 8 4854 7 -151 9 4853 8 -152 10 4852 9 -153 11 4851 10 -154 12 4850 11 -155 13 4849 12 -156 14 4848 13 -157 15 4847 14 -158 16 4846 15 -159 17 4845 16 -160 18 4844 17 -161 19 4...
result:
ok ok Sum L = 5000
Test #19:
score: 0
Accepted
time: 0ms
memory: 1612kb
input:
12 1000 1000 50 1000 -1000 50 1000 999 50 999 1000 50 999 -1000 50 -999 1000 50 1000 -999 50 -999 -1000 50 -1000 1000 50 -1000 -1000 50 -1000 -999 50 -1000 999 50
output:
50 24 -1000 -1000 -6003 -999 -999 -1000 -6002 -999 999 -1000 -4004 -999 1000 -1000 -4003 -999 -1000 -999 -6003 -998 1000 -999 -4003 -998 -1000 999 4004 998 1000 999 6004 998 -1000 1000 4004 999 -999 1000 4005 999 999 1000 6003 999 1000 1000 6004 999 24 -1000 -1000 4004 -1001 -999 -1000 4005 -1001 99...
result:
ok ok Sum L = 1200
Test #20:
score: 0
Accepted
time: 0ms
memory: 1536kb
input:
4 1000 1000 50 1000 -1000 50 -1000 1000 50 -1000 -1000 50
output:
50 8 -1000 -1000 -6003 -999 1000 -1000 -4003 -999 -1000 1000 4004 999 1000 1000 6004 999 8 -1000 -1000 4004 -1001 1000 -1000 6004 -1001 -1000 1000 14011 997 1000 1000 16011 997 8 -1000 -1000 14011 -1003 1000 -1000 16011 -1003 -1000 1000 24018 995 1000 1000 26018 995 8 -1000 -1000 24018 -1005 1000 -1...
result:
ok ok Sum L = 400
Extra Test:
score: 0
Extra Test Passed