QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#516575#7680. SubwaypandapythonerAC ✓1ms3892kbC++231.6kb2024-08-12 19:01:142024-08-12 19:01:15

Judging History

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

  • [2024-08-12 19:01:15]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3892kb
  • [2024-08-12 19:01:14]
  • 提交

answer

#include <bits/stdc++.h>


using namespace std;


using ll = long long;

#define rep(i, n) for(int i = 0; i < (n); i += 1)
#define rng(i, start, end, step) for(int i = start; i < end; i += step)
#define len(a) ((int)(a).size())


mt19937 rnd(234);


int32_t main() {
    if (1) {
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    }
    int n;
    cin >> n;
    vector<array<int, 3>> a(n);
    rep(i, n) rep(j, 3) cin >> a[i][j];
    int mx = 0;
    rep(i, n) mx = max(mx, a[i][2]);
    sort(a.begin(), a.end(), [&](array<int, 3> a, array<int, 3> b) {
        return a[0] * 2 + 10001 * a[1] < b[0] * 2 + 10001 * b[1];
        });
    vector<array<int, 2>> d(n - 1);
    rep(i, n - 1) d[i] = { a[i][0] - 5000, a[i][1] + 1 };
    d.insert(d.begin(), { -1001, -1001 });
    d.insert(d.end(), { 1001, 1001 });
    vector<vector<array<int, 2>>> lines(mx);
    rep(itr, mx) {
        rep(i, n) {
            lines[itr].push_back({ d[i][0], d[i][1] });
            d[i][0] -= 10001;
            d[i][1] += 2;
            if (a[i][2] > 0) {
                lines[itr].push_back({ a[i][0], a[i][1] });
                a[i][2] -= 1;
            }
            if (i == n - 1) {
                lines[itr].push_back({ d[i + 1][0], d[i + 1][1] });
                d[i + 1][0] -= 10001;
                d[i + 1][1] += 2;
            }
        }
    }
    cout << mx << "\n";
    for (auto line : lines) {
        cout << len(line);
        for (auto [x, y] : line) {
            cout << " " << x << " " << y;
        }
        cout << "\n";
    }
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1 2 1
2 1 2
3 3 2

output:

2
7 -1001 -1001 2 1 -4998 2 1 2 -4999 3 3 3 1001 1001
6 -11002 -999 2 1 -14999 4 -15000 5 3 3 -9000 1003

result:

ok ok Sum L = 13

Test #2:

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

input:

1
1 1 1

output:

1
3 -1001 -1001 1 1 1001 1001

result:

ok ok Sum L = 3

Test #3:

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

input:

1
1 1 50

output:

50
3 -1001 -1001 1 1 1001 1001
3 -11002 -999 1 1 -9000 1003
3 -21003 -997 1 1 -19001 1005
3 -31004 -995 1 1 -29002 1007
3 -41005 -993 1 1 -39003 1009
3 -51006 -991 1 1 -49004 1011
3 -61007 -989 1 1 -59005 1013
3 -71008 -987 1 1 -69006 1015
3 -81009 -985 1 1 -79007 1017
3 -91010 -983 1 1 -89008 1019
...

result:

ok ok Sum L = 150

Test #4:

score: 0
Accepted
time: 1ms
memory: 3660kb

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
101 -1001 -1001 961 -919 -4039 -918 -306 -897 -5306 -896 334 -893 -4666 -892 -371 -812 -5371 -811 -885 -775 -5885 -774 -668 -725 -5668 -724 -462 -719 -5462 -718 202 -702 -4798 -701 -870 -697 -5870 -696 -888 -667 -5888 -666 -548 -652 -5548 -651 662 -567 -4338 -566 736 -551 -4264 -550 -784 -537 -57...

result:

ok ok Sum L = 3743

Test #5:

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

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
101 -1001 -1001 -162 -959 -5162 -958 -756 -909 -5756 -908 -192 -890 -5192 -889 30 -869 -4970 -868 -197 -795 -5197 -794 749 -723 -4251 -722 -571 -716 -5571 -715 -216 -711 -5216 -710 -273 -672 -5273 -671 473 -639 -4527 -638 333 -637 -4667 -636 360 -630 -4640 -629 -135 -509 -5135 -508 -595 -470 -5595...

result:

ok ok Sum L = 101

Test #6:

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

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
101 -1001 -1001 356 -986 -4644 -985 348 -975 -4652 -974 -552 -966 -5552 -965 618 -911 -4382 -910 846 -893 -4154 -892 594 -847 -4406 -846 674 -804 -4326 -803 -637 -801 -5637 -800 871 -799 -4129 -798 17 -757 -4983 -756 -615 -675 -5615 -674 840 -638 -4160 -637 -792 -625 -5792 -624 -888 -613 -5888 -61...

result:

ok ok Sum L = 396

Test #7:

score: 0
Accepted
time: 1ms
memory: 3640kb

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
101 -1001 -1001 -313 -996 -5313 -995 -285 -980 -5285 -979 -767 -974 -5767 -973 932 -941 -4068 -940 -258 -938 -5258 -937 -813 -921 -5813 -920 -325 -875 -5325 -874 -19 -845 -5019 -844 166 -766 -4834 -765 -560 -748 -5560 -747 -397 -741 -5397 -740 -189 -728 -5189 -727 -48 -721 -5048 -720 269 -705 -47...

result:

ok ok Sum L = 791

Test #8:

score: 0
Accepted
time: 1ms
memory: 3600kb

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
101 -1001 -1001 75 -958 -4925 -957 -282 -917 -5282 -916 24 -889 -4976 -888 173 -857 -4827 -856 273 -830 -4727 -829 808 -695 -4192 -694 537 -637 -4463 -636 -749 -631 -5749 -630 938 -596 -4062 -595 -515 -540 -5515 -539 -958 -511 -5958 -510 -649 -479 -5649 -478 139 -450 -4861 -449 531 -449 -4469 -44...

result:

ok ok Sum L = 4818

Test #9:

score: 0
Accepted
time: 1ms
memory: 3816kb

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
101 -1001 -1001 -302 -989 -5302 -988 267 -965 -4733 -964 -367 -951 -5367 -950 417 -944 -4583 -943 197 -923 -4803 -922 481 -873 -4519 -872 -126 -799 -5126 -798 643 -779 -4357 -778 913 -700 -4087 -699 498 -636 -4502 -635 150 -618 -4850 -617 -882 -602 -5882 -601 895 -564 -4105 -563 27 -476 -4973 -47...

result:

ok ok Sum L = 5050

Test #10:

score: 0
Accepted
time: 1ms
memory: 3892kb

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
101 -1001 -1001 -2 -5 -5002 -4 0 -5 -5000 -4 1 -5 -4999 -4 2 -5 -4998 -4 -5 -4 -5005 -3 -4 -4 -5004 -3 -1 -4 -5001 -3 0 -4 -5000 -3 1 -4 -4999 -3 5 -4 -4995 -3 -5 -3 -5005 -2 -4 -3 -5004 -2 -3 -3 -5003 -2 0 -3 -5000 -2 2 -3 -4998 -2 -3 -2 -5003 -1 0 -2 -5000 -1 1 -2 -4999 -1 3 -2 -4997 -1 -3 -1 -...

result:

ok ok Sum L = 3974

Test #11:

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

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
101 -1001 -1001 -5 -5 -5005 -4 3 -5 -4997 -4 5 -5 -4995 -4 -4 -4 -5004 -3 -3 -4 -5003 -3 -2 -4 -5002 -3 -1 -4 -5001 -3 1 -4 -4999 -3 2 -4 -4998 -3 -5 -3 -5005 -2 -3 -3 -5003 -2 2 -3 -4998 -2 3 -3 -4997 -2 -3 -2 -5003 -1 -2 -2 -5002 -1 -1 -2 -5001 -1 0 -2 -5000 -1 1 -2 -4999 -1 2 -2 -4998 -1 3 -2 -...

result:

ok ok Sum L = 188

Test #12:

score: 0
Accepted
time: 1ms
memory: 3680kb

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
101 -1001 -1001 -5 -5 -5005 -4 -4 -5 -5004 -4 -3 -5 -5003 -4 -1 -5 -5001 -4 1 -5 -4999 -4 2 -5 -4998 -4 -3 -4 -5003 -3 -2 -4 -5002 -3 -1 -4 -5001 -3 0 -4 -5000 -3 1 -4 -4999 -3 4 -4 -4996 -3 -5 -3 -5005 -2 -2 -3 -5002 -2 0 -3 -5000 -2 1 -3 -4999 -2 3 -3 -4997 -2 4 -3 -4996 -2 5 -3 -4995 -2 -1 -2 ...

result:

ok ok Sum L = 5027

Test #13:

score: 0
Accepted
time: 1ms
memory: 3672kb

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
101 -1001 -1001 114 514 -4886 515 115 514 -4885 515 116 514 -4884 515 117 514 -4883 515 118 514 -4882 515 119 514 -4881 515 120 514 -4880 515 121 514 -4879 515 122 514 -4878 515 123 514 -4877 515 124 514 -4876 515 125 514 -4875 515 126 514 -4874 515 127 514 -4873 515 128 514 -4872 515 129 514 -48...

result:

ok ok Sum L = 3651

Test #14:

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

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
101 -1001 -1001 191 932 -4809 933 191 933 -4809 934 191 934 -4809 935 191 935 -4809 936 191 936 -4809 937 191 937 -4809 938 191 938 -4809 939 191 939 -4809 940 191 940 -4809 941 191 941 -4809 942 191 942 -4809 943 191 943 -4809 944 191 944 -4809 945 191 945 -4809 946 191 946 -4809 947 191 947 -48...

result:

ok ok Sum L = 3651

Test #15:

score: 0
Accepted
time: 1ms
memory: 3668kb

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
101 -1001 -1001 -123 456 -5123 457 -122 457 -5122 458 -121 458 -5121 459 -120 459 -5120 460 -119 460 -5119 461 -118 461 -5118 462 -117 462 -5117 463 -116 463 -5116 464 -115 464 -5115 465 -114 465 -5114 466 -113 466 -5113 467 -112 467 -5112 468 -111 468 -5111 469 -110 469 -5110 470 -109 470 -5109 ...

result:

ok ok Sum L = 3756

Test #16:

score: 0
Accepted
time: 1ms
memory: 3584kb

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
101 -1001 -1001 370 -574 -4630 -573 369 -573 -4631 -572 368 -572 -4632 -571 367 -571 -4633 -570 366 -570 -4634 -569 365 -569 -4635 -568 364 -568 -4636 -567 363 -567 -4637 -566 362 -566 -4638 -565 361 -565 -4639 -564 360 -564 -4640 -563 359 -563 -4641 -562 358 -562 -4642 -561 357 -561 -4643 -560 3...

result:

ok ok Sum L = 3762

Test #17:

score: 0
Accepted
time: 1ms
memory: 3604kb

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
101 -1001 -1001 -493 -604 -5493 -603 -492 -603 -5492 -602 -491 -602 -5491 -601 -490 -601 -5490 -600 -489 -600 -5489 -599 -488 -599 -5488 -598 -487 -598 -5487 -597 -486 -597 -5486 -596 -485 -596 -5485 -595 -484 -595 -5484 -594 -483 -594 -5483 -593 -482 -593 -5482 -592 -481 -592 -5481 -591 -480 -59...

result:

ok ok Sum L = 3711

Test #18:

score: 0
Accepted
time: 1ms
memory: 3656kb

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
101 -1001 -1001 -142 0 -5142 1 -143 1 -5143 2 -144 2 -5144 3 -145 3 -5145 4 -146 4 -5146 5 -147 5 -5147 6 -148 6 -5148 7 -149 7 -5149 8 -150 8 -5150 9 -151 9 -5151 10 -152 10 -5152 11 -153 11 -5153 12 -154 12 -5154 13 -155 13 -5155 14 -156 14 -5156 15 -157 15 -5157 16 -158 16 -5158 17 -159 17 -51...

result:

ok ok Sum L = 3861

Test #19:

score: 0
Accepted
time: 1ms
memory: 3556kb

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
25 -1001 -1001 -1000 -1000 -6000 -999 -999 -1000 -5999 -999 999 -1000 -4001 -999 1000 -1000 -4000 -999 -1000 -999 -6000 -998 1000 -999 -4000 -998 -1000 999 -6000 1000 1000 999 -4000 1000 -1000 1000 -6000 1001 -999 1000 -5999 1001 999 1000 -4001 1001 1000 1000 1001 1001
25 -11002 -999 -1000 -1000 ...

result:

ok ok Sum L = 1250

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
9 -1001 -1001 -1000 -1000 -6000 -999 1000 -1000 -4000 -999 -1000 1000 -6000 1001 1000 1000 1001 1001
9 -11002 -999 -1000 -1000 -16001 -997 1000 -1000 -14001 -997 -1000 1000 -16001 1003 1000 1000 -9000 1003
9 -21003 -997 -1000 -1000 -26002 -995 1000 -1000 -24002 -995 -1000 1000 -26002 1005 1000 10...

result:

ok ok Sum L = 450

Extra Test:

score: 0
Extra Test Passed