QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#240460 | #7680. Subway | ucup-team1198# | AC ✓ | 1ms | 3832kb | C++20 | 1.6kb | 2023-11-05 15:37:41 | 2023-11-05 15:37:41 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define ld long double
#define all(a) (a).begin(), (a).end()
const int N = 1010;
const int P = 3 * N;
array<int, 2> go(array<int, 2> pos, int k) {
int x = pos[0], y = pos[1];
y = y + 1 + (P + 1) * k;
x = x + P + 1 + P * (P + 1) * k + k;
return {x, y};
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<array<int, 3>> a(n);
int mx = 0;
for (int i = 0; i < n; ++i) {
cin >> a[i][0] >> a[i][1] >> a[i][2];
mx = max(mx, a[i][2]);
}
sort(a.begin(), a.end(), [](array<int, 3> p, array<int, 3> q) {
if (p[1] == q[1]) return p[0] < q[0];
return p[1] > q[1];
});
vector<array<int, 2>> rep(n);
for (int i = 0; i < n; ++i) {
rep[i] = {a[i][0] + P * (N - a[i][1]), N};
}
cout << mx << "\n";
for (int t = 0; t < mx; ++t) {
vector<int> ind;
for (int i = 0; i < n; ++i) {
if (a[i][2] > t) {
ind.push_back(i);
}
}
vector<array<int, 2>> ans;
for (int i = 0; i < (int)ind.size(); ++i) {
if (i != 0 && ind[i - 1] + 1 != ind[i]) {
ans.push_back(go(rep[ind[i] - 1], t));
}
ans.push_back({a[ind[i]][0], a[ind[i]][1]});
ans.push_back(go(rep[ind[i]], t));
}
cout << ans.size() << " ";
for (auto elem : ans) {
cout << elem[0] << " " << elem[1] << " ";
}
cout << "\n";
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3752kb
input:
3 1 2 1 2 1 2 3 3 2
output:
2 6 3 3 3054244 1011 1 2 3057272 1011 2 1 3060303 1011 5 3 3 12238175 4042 12241203 4042 2 1 12244234 4042
result:
ok ok Sum L = 11
Test #2:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
1 1 1 1
output:
1 2 1 1 3060302 1011
result:
ok ok Sum L = 2
Test #3:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
1 1 1 50
output:
50 2 1 1 3060302 1011 2 1 1 12244233 4042 2 1 1 21428164 7073 2 1 1 30612095 10104 2 1 1 39796026 13135 2 1 1 48979957 16166 2 1 1 58163888 19197 2 1 1 67347819 22228 2 1 1 76531750 25259 2 1 1 85715681 28290 2 1 1 94899612 31321 2 1 1 104083543 34352 2 1 1 113267474 37383 2 1 1 1224514...
result:
ok ok Sum L = 100
Test #4:
score: 0
Accepted
time: 1ms
memory: 3704kb
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 190 864 445601 1011 -558 825 563023 1011 -182 810 608849 1011 428 810 609459 1011 -683 731 847718 1011 -926 671 1029275 1011 307 669 1036568 1011 507 469 1642768 1011 -449 456 1681202 1011 560 405 1836741 1011 -945 382 1904926 1011 -825 381 1908076 1011 684 360 1973215 1011 -81 261 2272420 10...
result:
ok ok Sum L = 2850
Test #5:
score: 0
Accepted
time: 0ms
memory: 3536kb
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 277 928 251768 1011 659 923 267300 1011 -304 897 345117 1011 -530 890 366101 1011 175 846 500126 1011 -187 841 514914 1011 -532 838 523659 1011 -254 815 593627 1011 995 711 909996 1011 -389 708 917702 1011 -772 697 950649 1011 133 685 987914 1011 684 618 1191475 1011 -573 613 1205368 1011 -66 ...
result:
ok ok Sum L = 100
Test #6:
score: 0
Accepted
time: 0ms
memory: 3624kb
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 692 994 52203 1011 -104 972 118067 1011 826 959 158387 1011 699 854 476410 1011 -56 747 799865 1011 -293 667 1042028 1011 345 628 1160836 1011 -159 609 1217902 1011 830 609 1218891 1011 789 581 1303690 1011 -47 393 1872494 1011 -842 381 1908059 1011 -999 330 2062432 1011 -483 256 2287168 1011 ...
result:
ok ok Sum L = 323
Test #7:
score: 0
Accepted
time: 0ms
memory: 3600kb
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 600 997 43021 1011 274 948 191165 1011 -99 819 581662 1011 -747 816 590104 1011 -324 816 590527 1011 898 801 637199 1011 775 786 682526 1011 -980 753 780761 1011 -215 624 1172396 1011 -627 605 1229554 1011 101 576 1318152 1011 -419 564 1353992 1011 408 443 1721449 1011 760 317 2103581 1011 99...
result:
ok ok Sum L = 628
Test #8:
score: 0
Accepted
time: 1ms
memory: 3628kb
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 210 944 203221 1011 801 910 306832 1011 -195 889 369466 1011 -486 866 438865 1011 810 830 549241 1011 -615 809 611446 1011 714 724 870325 1011 134 661 1060635 1011 -308 652 1087463 1011 -127 643 1114914 1011 151 574 1324262 1011 25 524 1475636 1011 -912 466 1650439 1011 117 418 1796908 1011 5...
result:
ok ok Sum L = 4615
Test #9:
score: 0
Accepted
time: 1ms
memory: 3600kb
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 -515 975 108566 1011 -501 927 254020 1011 896 846 500847 1011 262 792 663833 1011 -474 780 699457 1011 -846 729 853615 1011 -2 713 902939 1011 644 701 939945 1011 21 679 1005982 1011 50 646 1106001 1011 -841 601 1241460 1011 808 569 1340069 1011 253 550 1397084 1011 842 452 1694613 1011 -324 ...
result:
ok ok Sum L = 5000
Test #10:
score: 0
Accepted
time: 1ms
memory: 3832kb
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 -3 5 3048178 1011 -2 5 3048179 1011 -1 5 3048180 1011 0 5 3048181 1011 1 5 3048182 1011 3 5 3048184 1011 4 5 3048185 1011 -1 4 3051210 1011 2 4 3051213 1011 4 4 3051215 1011 -3 3 3054238 1011 -1 3 3054240 1011 0 3 3054241 1011 -2 2 3057269 1011 2 2 3057273 1011 5 2 3057276 1011 -5 1 3060296 1...
result:
ok ok Sum L = 3196
Test #11:
score: 0
Accepted
time: 0ms
memory: 3812kb
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 3048176 1011 -4 5 3048177 1011 -3 5 3048178 1011 -2 5 3048179 1011 2 5 3048183 1011 3 5 3048184 1011 5 5 3048186 1011 -4 4 3051207 1011 -2 4 3051209 1011 4 4 3051215 1011 2 3 3054243 1011 5 3 3054246 1011 -3 2 3057268 1011 -2 2 3057269 1011 -1 2 3057270 1011 2 2 3057273 1011 4 2 3057275 1...
result:
ok ok Sum L = 181
Test #12:
score: 0
Accepted
time: 1ms
memory: 3604kb
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 3048176 1011 -3 5 3048178 1011 -1 5 3048180 1011 0 5 3048181 1011 3 5 3048184 1011 -5 4 3051206 1011 -4 4 3051207 1011 0 4 3051211 1011 1 4 3051212 1011 5 4 3051216 1011 -2 3 3054239 1011 4 3 3054245 1011 0 2 3057271 1011 1 2 3057272 1011 3 2 3057274 1011 4 2 3057275 1011 -4 1 3060297 10...
result:
ok ok Sum L = 4965
Test #13:
score: 0
Accepted
time: 1ms
memory: 3620kb
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 1506025 1011 115 514 1506026 1011 116 514 1506027 1011 117 514 1506028 1011 118 514 1506029 1011 119 514 1506030 1011 120 514 1506031 1011 121 514 1506032 1011 122 514 1506033 1011 123 514 1506034 1011 124 514 1506035 1011 125 514 1506036 1011 126 514 1506037 1011 127 514 1506038 1011...
result:
ok ok Sum L = 2646
Test #14:
score: 0
Accepted
time: 1ms
memory: 3620kb
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 981 91092 1011 191 980 94122 1011 191 979 97152 1011 191 978 100182 1011 191 977 103212 1011 191 976 106242 1011 191 975 109272 1011 191 974 112302 1011 191 973 115332 1011 191 972 118362 1011 191 971 121392 1011 191 970 124422 1011 191 969 127452 1011 191 968 130482 1011 191 967 133512 1...
result:
ok ok Sum L = 2679
Test #15:
score: 0
Accepted
time: 0ms
memory: 3636kb
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 -74 505 1533107 1011 -75 504 1536136 1011 -76 503 1539165 1011 -77 502 1542194 1011 -78 501 1545223 1011 -79 500 1548252 1011 -80 499 1551281 1011 -81 498 1554310 1011 -82 497 1557339 1011 -83 496 1560368 1011 -84 495 1563397 1011 -85 494 1566426 1011 -86 493 1569455 1011 -87 492 1572484 1011...
result:
ok ok Sum L = 2814
Test #16:
score: 0
Accepted
time: 0ms
memory: 3780kb
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 321 -525 4654402 1011 322 -526 4657433 1011 323 -527 4660464 1011 324 -528 4663495 1011 325 -529 4666526 1011 326 -530 4669557 1011 327 -531 4672588 1011 328 -532 4675619 1011 329 -533 4678650 1011 330 -534 4681681 1011 331 -535 4684712 1011 332 -536 4687743 1011 333 -537 4690774 1011 334 -53...
result:
ok ok Sum L = 2857
Test #17:
score: 0
Accepted
time: 1ms
memory: 3600kb
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 -444 -555 4744537 1011 -445 -556 4747566 1011 -446 -557 4750595 1011 -447 -558 4753624 1011 -448 -559 4756653 1011 -449 -560 4759682 1011 -450 -561 4762711 1011 -451 -562 4765740 1011 -452 -563 4768769 1011 -453 -564 4771798 1011 -454 -565 4774827 1011 -455 -566 4777856 1011 -456 -567 4780885...
result:
ok ok Sum L = 2719
Test #18:
score: 0
Accepted
time: 0ms
memory: 3604kb
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 -191 49 2914670 1011 -190 48 2917701 1011 -189 47 2920732 1011 -188 46 2923763 1011 -187 45 2926794 1011 -186 44 2929825 1011 -185 43 2932856 1011 -184 42 2935887 1011 -183 41 2938918 1011 -182 40 2941949 1011 -181 39 2944980 1011 -180 38 2948011 1011 -179 37 2951042 1011 -178 36 2954073 1011...
result:
ok ok Sum L = 3068
Test #19:
score: 0
Accepted
time: 0ms
memory: 3612kb
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 32331 1011 -999 1000 32332 1011 999 1000 34330 1011 1000 1000 34331 1011 -1000 999 35361 1011 1000 999 37361 1011 -1000 -999 6089301 1011 1000 -999 6091301 1011 -1000 -1000 6092331 1011 -999 -1000 6092332 1011 999 -1000 6094330 1011 1000 -1000 6094331 1011 24 -1000 1000 9216262 404...
result:
ok ok Sum L = 1200
Test #20:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
4 1000 1000 50 1000 -1000 50 -1000 1000 50 -1000 -1000 50
output:
50 8 -1000 1000 32331 1011 1000 1000 34331 1011 -1000 -1000 6092331 1011 1000 -1000 6094331 1011 8 -1000 1000 9216262 4042 1000 1000 9218262 4042 -1000 -1000 15276262 4042 1000 -1000 15278262 4042 8 -1000 1000 18400193 7073 1000 1000 18402193 7073 -1000 -1000 24460193 7073 1000 -1000 24462193 7073...
result:
ok ok Sum L = 400
Extra Test:
score: 0
Extra Test Passed