QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#143486#1140. Distributing CandiesQwerty1232100 ✓1111ms11948kbC++2013.8kb2023-08-21 14:06:352023-08-21 14:06:38

Judging History

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

  • [2023-08-21 14:06:38]
  • 评测
  • 测评结果:100
  • 用时:1111ms
  • 内存:11948kb
  • [2023-08-21 14:06:35]
  • 提交

answer

#pragma GCC optimize("O3")
#pragma GCC target("avx512f,avx512vl,avx512dq,avx512bw")
// #pragma GCC target("avx2")
#include <algorithm>
#include <cstdint>
#include <functional>
#include <iostream>
#include <vector>

#include "candies.h"

constexpr int N = 2e5 + 5;

int c[N], s[N];

std::vector<int> distribute_candies(std::vector<int> C, std::vector<int> L, std::vector<int> R, std::vector<int> V) {
    int n = C.size();
    int q = L.size();

    // std::vector<int> s(n);
    std::copy(C.begin(), C.end(), c);
    std::fill(s, s + n, 0);

    int cnt = std::count_if(V.begin(), V.end(), [&](auto a) { return a > 0; });
    bool rev = false;
    if (cnt > q / 2) {
        rev = true;
        std::copy(c, c + n, s);
        for (int i = 0; i < q; i++) {
            V[i] *= -1;
        }
    }

    constexpr int G = 100;
    std::vector<int> p;
    for (int i = 0; i < G; i++) {
        p.push_back(n / G * i);
    }
    p.push_back(n);

    for (int it = 0; it < G; it++) {
        for (int i = 0; i < q; i++) {
            if (1 && i + 3 < q && L[i] <= p[it] && L[i + 1] <= p[it] && p[it + 1] - 1 <= R[i] && p[it + 1] - 1 <= R[i + 1] && L[i + 2] <= p[it] && p[it + 1] - 1 <= R[i + 2] &&
                L[i + 3] <= p[it] && p[it + 1] - 1 <= R[i + 3]) {
                int l = p[it], r = p[it + 1];
                int dlt1 = V[i], dlt2 = V[i + 1], dlt3 = V[i + 2], dlt4 = V[i + 3];

                if (dlt1 < 0 && dlt2 < 0 && dlt3 < 0 && dlt4 < 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::max(0, a + dlt1);
                        a = std::max(0, a + dlt2);
                        a = std::max(0, a + dlt3);
                        a = std::max(0, a + dlt4);
                        s[j] = a;
                    }
                } else if (dlt1 >= 0 && dlt2 < 0 && dlt3 < 0 && dlt4 < 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::min(c[j], a + dlt1);
                        a = std::max(0, a + dlt2);
                        a = std::max(0, a + dlt3);
                        a = std::max(0, a + dlt4);
                        s[j] = a;
                    }
                } else if (dlt1 < 0 && dlt2 >= 0 && dlt3 < 0 && dlt4 < 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::max(0, a + dlt1);
                        a = std::min(c[j], a + dlt2);
                        a = std::max(0, a + dlt3);
                        a = std::max(0, a + dlt4);
                        s[j] = a;
                    }
                } else if (dlt1 >= 0 && dlt2 >= 0 && dlt3 < 0 && dlt4 < 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::min(c[j], a + dlt1);
                        a = std::min(c[j], a + dlt2);
                        a = std::max(0, a + dlt3);
                        a = std::max(0, a + dlt4);
                        s[j] = a;
                    }
                } else if (dlt1 < 0 && dlt2 < 0 && dlt3 >= 0 && dlt4 < 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::max(0, a + dlt1);
                        a = std::max(0, a + dlt2);
                        a = std::min(c[j], a + dlt3);
                        a = std::max(0, a + dlt4);
                        s[j] = a;
                    }
                } else if (dlt1 >= 0 && dlt2 < 0 && dlt3 >= 0 && dlt4 < 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::min(c[j], a + dlt1);
                        a = std::max(0, a + dlt2);
                        a = std::min(c[j], a + dlt3);
                        a = std::max(0, a + dlt4);
                        s[j] = a;
                    }
                } else if (dlt1 < 0 && dlt2 >= 0 && dlt3 >= 0 && dlt4 < 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::max(0, a + dlt1);
                        a = std::min(c[j], a + dlt2);
                        a = std::min(c[j], a + dlt3);
                        a = std::max(0, a + dlt4);
                        s[j] = a;
                    }
                } else if (dlt1 >= 0 && dlt2 >= 0 && dlt3 >= 0 && dlt4 < 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::min(c[j], a + dlt1);
                        a = std::min(c[j], a + dlt2);
                        a = std::min(c[j], a + dlt3);
                        a = std::max(0, a + dlt4);
                        s[j] = a;
                    }
                } else if (dlt1 < 0 && dlt2 < 0 && dlt3 < 0 && dlt4 >= 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::max(0, a + dlt1);
                        a = std::max(0, a + dlt2);
                        a = std::max(0, a + dlt3);
                        a = std::min(c[j], a + dlt4);
                        s[j] = a;
                    }
                } else if (dlt1 >= 0 && dlt2 < 0 && dlt3 < 0 && dlt4 >= 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::min(c[j], a + dlt1);
                        a = std::max(0, a + dlt2);
                        a = std::max(0, a + dlt3);
                        a = std::min(c[j], a + dlt4);
                        s[j] = a;
                    }
                } else if (dlt1 < 0 && dlt2 >= 0 && dlt3 < 0 && dlt4 >= 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::max(0, a + dlt1);
                        a = std::min(c[j], a + dlt2);
                        a = std::max(0, a + dlt3);
                        a = std::min(c[j], a + dlt4);
                        s[j] = a;
                    }
                } else if (dlt1 >= 0 && dlt2 >= 0 && dlt3 < 0 && dlt4 >= 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::min(c[j], a + dlt1);
                        a = std::min(c[j], a + dlt2);
                        a = std::max(0, a + dlt3);
                        a = std::min(c[j], a + dlt4);
                        s[j] = a;
                    }
                } else if (dlt1 < 0 && dlt2 < 0 && dlt3 >= 0 && dlt4 >= 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::max(0, a + dlt1);
                        a = std::max(0, a + dlt2);
                        a = std::min(c[j], a + dlt3);
                        a = std::min(c[j], a + dlt4);
                        s[j] = a;
                    }
                } else if (dlt1 >= 0 && dlt2 < 0 && dlt3 >= 0 && dlt4 >= 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::min(c[j], a + dlt1);
                        a = std::max(0, a + dlt2);
                        a = std::min(c[j], a + dlt3);
                        a = std::min(c[j], a + dlt4);
                        s[j] = a;
                    }
                } else if (dlt1 < 0 && dlt2 >= 0 && dlt3 >= 0 && dlt4 >= 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::max(0, a + dlt1);
                        a = std::min(c[j], a + dlt2);
                        a = std::min(c[j], a + dlt3);
                        a = std::min(c[j], a + dlt4);
                        s[j] = a;
                    }
                } else if (dlt1 >= 0 && dlt2 >= 0 && dlt3 >= 0 && dlt4 >= 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::min(c[j], a + dlt1);
                        a = std::min(c[j], a + dlt2);
                        a = std::min(c[j], a + dlt3);
                        a = std::min(c[j], a + dlt4);
                        s[j] = a;
                    }
                }

                i += 3;
                continue;
            }
            if (1 && i + 2 < q && L[i] <= p[it] && L[i + 1] <= p[it] && p[it + 1] - 1 <= R[i] && p[it + 1] - 1 <= R[i + 1] && L[i + 2] <= p[it] && p[it + 1] - 1 <= R[i + 2]) {
                int l = p[it], r = p[it + 1];
                int dlt1 = V[i], dlt2 = V[i + 1], dlt3 = V[i + 2];

                if (dlt1 < 0 && dlt2 < 0 && dlt3 < 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::max(0, a + dlt1);
                        a = std::max(0, a + dlt2);
                        a = std::max(0, a + dlt3);
                        s[j] = a;
                    }
                } else if (dlt1 >= 0 && dlt2 < 0 && dlt3 < 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::min(c[j], a + dlt1);
                        a = std::max(0, a + dlt2);
                        a = std::max(0, a + dlt3);
                        s[j] = a;
                    }
                } else if (dlt1 < 0 && dlt2 >= 0 && dlt3 < 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::max(0, a + dlt1);
                        a = std::min(c[j], a + dlt2);
                        a = std::max(0, a + dlt3);
                        s[j] = a;
                    }
                } else if (dlt1 >= 0 && dlt2 >= 0 && dlt3 < 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::min(c[j], a + dlt1);
                        a = std::min(c[j], a + dlt2);
                        a = std::max(0, a + dlt3);
                        s[j] = a;
                    }
                } else if (dlt1 < 0 && dlt2 < 0 && dlt3 >= 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::max(0, a + dlt1);
                        a = std::max(0, a + dlt2);
                        a = std::min(c[j], a + dlt3);
                        s[j] = a;
                    }
                } else if (dlt1 >= 0 && dlt2 < 0 && dlt3 >= 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::min(c[j], a + dlt1);
                        a = std::max(0, a + dlt2);
                        a = std::min(c[j], a + dlt3);
                        s[j] = a;
                    }
                } else if (dlt1 < 0 && dlt2 >= 0 && dlt3 >= 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::max(0, a + dlt1);
                        a = std::min(c[j], a + dlt2);
                        a = std::min(c[j], a + dlt3);
                        s[j] = a;
                    }
                } else if (dlt1 >= 0 && dlt2 >= 0 && dlt3 >= 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::min(c[j], a + dlt1);
                        a = std::min(c[j], a + dlt2);
                        a = std::min(c[j], a + dlt3);
                        s[j] = a;
                    }
                }

                i += 2;
                continue;
            }
            if (1 && i + 1 < q && L[i] <= p[it] && L[i + 1] <= p[it] && p[it + 1] - 1 <= R[i] && p[it + 1] - 1 <= R[i + 1]) {
                int l = p[it], r = p[it + 1];
                int dlt1 = V[i], dlt2 = V[i + 1];

                if (dlt1 < 0 && dlt2 < 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::max(0, a + dlt1);
                        a = std::max(0, a + dlt2);
                        s[j] = a;
                    }
                } else if (dlt1 >= 0 && dlt2 < 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::min(c[j], a + dlt1);
                        a = std::max(0, a + dlt2);
                        s[j] = a;
                    }
                } else if (dlt1 < 0 && dlt2 >= 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::max(0, a + dlt1);
                        a = std::min(c[j], a + dlt2);
                        s[j] = a;
                    }
                } else if (dlt1 >= 0 && dlt2 >= 0) {
                    for (int j = l; j < r; j++) {
                        int a = s[j];
                        a = std::min(c[j], a + dlt1);
                        a = std::min(c[j], a + dlt2);
                        s[j] = a;
                    }
                }

                i++;
                continue;
            }

            int l = L[i], r = R[i], dlt = V[i];
            r++;

            l = std::max(l, p[it]);
            r = std::min(r, p[it + 1]);

            if (dlt < 0) {
                for (int j = l; j < r; j++) {
                    s[j] = std::max(0, s[j] + dlt);
                }
            } else {
                for (int j = l; j < r; j++) {
                    s[j] = std::min(c[j], s[j] + dlt);
                }
            }
        }
    }

    if (rev) {
        for (int i = 0; i < n; i++) {
            s[i] = c[i] - s[i];
        }
    }

    return std::vector<int>(s, s + n);
}

詳細信息

Subtask #1:

score: 3
Accepted

Test #1:

score: 3
Accepted
time: 1ms
memory: 3836kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
8
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
8
0 7 1
0 7 1
0 7 300000000
0 7 994967293
0 7 1
0 7 1000000000
0 7 1000000000
0 7 1000000000

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000

result:

ok 3 lines

Test #2:

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

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
10
283 43634 101056 10340 6009 5133 30 2 3677888 210
10
1 8 26416
2 7 -51219
2 4 17793
3 7 75426
3 7 22307
1 1 60258
3 7 -29824
0 8 24839
2 8 -60304
0 1 -26411

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 17223 0 0 0 0 0 0 0 0

result:

ok 3 lines

Test #3:

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

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
10
5895610 429664 3124 17993 758457 101345 5102817 1127952 59 81146
2000
6 7 44356
5 7 77812
1 4 -41353
1 7 -81697
2 5 -26607
4 9 84461
4 7 -44947
1 6 42622
3 5 -99951
0 1 -77687
2 6 52280
5 9 5073
1 9 67601
6 8 -6669
0 6 42368
4 6 22221
1 3 48306
3 6 -23492
...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
1520966 0 0 0 20922 69708 15240 91107 0 78774

result:

ok 3 lines

Test #4:

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

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
100
1281 616650 26929 344 1231 263 183010 1 1 46 144770 17 1735 9520 7 1 39535 8307 2 5 32940 498570 644480 10107 1645 21 443708 4 28177 2857127 2 1 1350 17506 5 36 1985 42978 24123 73 114 230034 5561405 11263 9754875 4671 44 3 8982 299 452 15 2619 9 7 6259 8...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 19101 26929 344 1231 263 14968 1 1 46 40142 17 1735 9520 7 1 31323 8307 2 5 16804 87522 84360 5468 1645 21 93788 4 28177 158016 2 1 1350 17506 5 36 1985 42978 24123 73 114 230034 248401 11263 290026 4671 44 3 8982 299 452 15 2619 9 7 6259 68282 104034 17...

result:

ok 3 lines

Test #5:

score: 0
Accepted
time: 4ms
memory: 3916kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
2000
30 43135 3633 8815565 7 10656 4747283 11 1955823 368399 1933641 1354338 121930 8151786 1 2 8 3693091 433 39590 3210647 4211 49 288876 9195 37 129470 1370232 65473 2 10572 49 15282 452 8700630 9946 17 3 39005 1040244 167569 37 2 24552 115 7 117 350655 198...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
30 43135 3633 342743 7 10656 352396 11 498344 368399 425526 434636 121930 524601 1 2 8 427431 433 39590 398492 4211 49 288876 9195 37 129470 481647 65473 2 10572 49 15282 452 865424 9946 17 3 39005 791920 135995 37 2 24552 115 7 117 319081 1988 18 846056 7...

result:

ok 3 lines

Subtask #2:

score: 8
Accepted

Test #6:

score: 8
Accepted
time: 566ms
memory: 11820kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
11408901 370732653 37843 28 53693 15782410 103 297546 1112427 170319071 26 1 6172 11614171 431 884673599 1 3 50085 154 57 28200 145886 898969 74758 72 845768 6 69787 11 31012465 55362 253 2363145 47186217 1103 19622 594 7867 1 4299 28130 48 4689582 12 ...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
87153 87153 37843 28 53693 406667 103 297546 766665 971468 26 1 6172 1257294 431 1536484 1 3 50085 154 57 28200 145886 898969 74758 72 845768 6 69787 11 3043755 55362 253 2363145 3459533 1103 19622 594 7867 1 4299 28130 48 4317336 12 431 123 4531465 4806 3...

result:

ok 3 lines

Test #7:

score: 0
Accepted
time: 557ms
memory: 11852kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
36 596 2 302 1 22 7381829 295 411 221 267845 2822 635 22 45033 2 3 24 15 1 585 2832326 80 499271 110 192 6185 1752 302907 52967 3 3423576 5373 63 2196 35 113 1209 303 12 89 4572 4 13274 5867 10158 33467 3128 776575 59189 23 11698 637 3 330 1 1 18 3534 ...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
36 295 2 302 1 22 529 295 411 221 771 931 635 22 997 2 3 24 15 1 585 1803 80 1928 110 192 2072 1752 2113 2222 3 2336 2351 63 2196 35 113 1209 303 12 89 3734 4 3736 3736 3931 4234 3128 4408 4562 23 5099 637 3 330 1 1 18 3534 2589 6286 6406 1042 6596 1 6685 ...

result:

ok 3 lines

Test #8:

score: 0
Accepted
time: 550ms
memory: 11916kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
423807 103641 5 2833 134 4447875 716134 10 300 7393 6 801 5256389 2604 521049 1670294 35 12249 12 29904 691656 393760 22 409 2 956844 8846653 19 1926 769 36 3577 55 524387 154184 165995 753 3709 29260 41947 89 27779 5115776 1 63 1 374 72 1788 41555 274...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
11 25 5 52 52 53 53 10 66 69 6 86 105 114 123 145 35 155 12 177 177 178 22 229 2 229 239 19 264 280 36 295 55 298 313 328 337 356 375 385 89 388 425 1 63 1 374 72 515 525 525 531 3 5 7 564 573 584 61 631 644 648 8 14 664 316 558 676 686 705 705 736 79 747 ...

result:

ok 3 lines

Subtask #3:

score: 27
Accepted

Test #9:

score: 27
Accepted
time: 1ms
memory: 3752kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 3 lines

Test #10:

score: 0
Accepted
time: 268ms
memory: 7900kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
2000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
1049802 936230 884511 204101 406074 550834 961642 2076245 1975297 2101513 2254310 1990108 1398298 1917785 2864344 2475931 2270774 401698970 402327667 402506418 401068637 399388438 398687119 398672863 397137012 397262070 396255448 395961553 394643443 394646...

result:

ok 3 lines

Test #11:

score: 0
Accepted
time: 28ms
memory: 7176kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 3 lines

Test #12:

score: 0
Accepted
time: 703ms
memory: 11820kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
27608 64753 120270 150200 99177 99177 69754 163659 163659 234722 182586 182586 182586 115212 115212 36356 36356 6028 6028 972950338 973018128 973018128 973018128 973018128 973123904 973123904 973124098 973020904 973039972 973136885 973173147 973200808 9730...

result:

ok 3 lines

Test #13:

score: 0
Accepted
time: 712ms
memory: 11816kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 3907113 13718455 22058386 22058386 22058386 17250429 17250429 22661114 22661114 13718455 26434847 24657287 31478180 40855091 34489940 34489940 34489940 34489940 34489940 34489940 34489940 41385683 41385683 45763396 45763396 45763396 45763396 40987755 409...

result:

ok 3 lines

Test #14:

score: 0
Accepted
time: 696ms
memory: 11828kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 0 0 0 0 0 0 0 0 0 0 920673668 920673668 920673668 920673668 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 555951031 55595103...

result:

ok 3 lines

Test #15:

score: 0
Accepted
time: 622ms
memory: 11912kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 2 2 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 2 2 ...

result:

ok 3 lines

Subtask #4:

score: 29
Accepted

Test #16:

score: 29
Accepted
time: 1ms
memory: 3732kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
10
11 440 51 41 11 1 3 108 148 14
10
0 9 60
0 9 -9
0 9 -30
0 9 41
0 9 82
0 9 69
0 9 -79
0 9 -39
0 9 72
0 9 41

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
11 208 51 41 11 1 3 108 143 14

result:

ok 3 lines

Test #17:

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

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
1000
6 129 1 3 18 414 46 7 33 2 29 3 395 143 120 62 343 102 568 40 49 1 37 7 31 66 12 1 330 4 3 10 3 216 2 375 15 786 1 156 243 411 519 14 13 13 667 2 382 294 1 556 53 2 368 1 32 5 201 13 376 369 91 11 14 5 584 65 3 443 1 989 889 22 8 177 140 7 481 6 371 142 ...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 68 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 3 lines

Test #18:

score: 0
Accepted
time: 183ms
memory: 7888kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
2000
4207825 17466917 11 20 10489 1278831 48720 43780703 37223309 28500011 76204785 631 321 1650 263304936 1382 1900 1 225756109 43424483 21143 218062355 851196097 633450 141629084 11494 1 19 12133 5908567 7 26138 1131 152662321 18 787906 312 11463 393 109417...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
780706 1955314 11 20 10489 659178 48720 1955314 1955314 1955314 1955314 631 321 1650 1955314 1382 1900 1 1955314 1955314 21143 1955314 1955314 633450 1955314 11494 1 19 12133 1691591 7 26138 1131 1955314 18 659178 312 11463 393 659178 659178 1180 1955314 5...

result:

ok 3 lines

Test #19:

score: 0
Accepted
time: 40ms
memory: 7080kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
401 38224076 293 9 2873526 11 356842329 318925257 728 169 749704686 13312846 8 6106116 4 379784 2 678669 1104 1268657 4579072 4620407 111763 117481111 81224 415449128 69269056 62353747 592 998 1135181 7443857 5706444 6 2 11 87555 3780941 72 8 407 11455...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 2136442 0 0 1590745 0 2136442 2136442 0 0 2136442 2136442 0 2136442 0 120361 0 120361 0 120361 2136442 2136442 24468 2136442 0 2136442 2136442 2136442 0 0 120361 2136442 2136442 0 0 0 260 2136442 0 0 0 0 2136442 0 0 0 1210287 2136442 2136442 0 2136442 0 ...

result:

ok 3 lines

Test #20:

score: 0
Accepted
time: 1094ms
memory: 11832kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
2 607917 87 7743038 272 19678 1 98 439 30 7898 262 2631381 23073 1026097 3698 6614 40 442324 168 3 43717 2370 1627514 8316081 398 1882901 1 42496 1 20135 29167 4032 6305 3894321 170 598 492 9418417 74322 2401853 52 42 31 145771 1720 63583 100 270 4249 ...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
2 56203 87 56203 148 12145 1 98 179 30 1408 148 56203 15540 56203 179 1408 40 56203 148 3 17751 179 56203 56203 179 56203 1 17751 1 12602 17751 179 1408 56203 148 179 179 56203 44280 56203 52 42 31 56203 179 33541 100 148 179 179 22 56203 56203 31 16 4 140...

result:

ok 3 lines

Test #21:

score: 0
Accepted
time: 1111ms
memory: 11940kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
11408901 370732653 37843 28 53693 15782410 103 297546 1112427 170319071 26 1 6172 11614171 431 884673599 1 3 50085 154 57 28200 145886 898969 74758 72 845768 6 69787 11 31012465 55362 253 2363145 47186217 1103 19622 594 7867 1 4299 28130 48 4689582 12 ...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
6103361 10904843 17 17 17 6103361 17 17 17 10904843 17 1 17 6103361 17 10904843 1 3 17 17 17 17 17 17 17 17 17 6 17 11 10904843 17 17 515937 10904843 17 17 17 17 1 17 17 17 515937 12 17 17 10904843 17 17 17 1 1 10904843 10904843 17 17 2 17 17 17 1 515937 1...

result:

ok 3 lines

Test #22:

score: 0
Accepted
time: 1111ms
memory: 11912kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
305263 281 10690 235 990069 52806771 124403 6 22 4901 18 4667 1944046 163079 358062945 167 258980 119407 434894470 51581578 40072504 9499993 3863 1269 1659 3 4 954 67916 18536 57095396 7 19561069 6 51690 595643338 5 902269 249 15 4526 1326847 3474 4157...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
305263 281 10690 235 990069 52806771 124403 6 22 4901 18 4667 1944046 163079 157437912 167 258980 119407 157437912 51581578 40072504 9499993 3863 1269 1659 3 4 954 67916 18536 57095396 7 19561069 6 51690 202403916 5 902269 249 15 4526 1326847 3474 41576 3 ...

result:

ok 3 lines

Test #23:

score: 0
Accepted
time: 1106ms
memory: 11848kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
36 596 2 302 1 22 7381829 295 411 221 267845 2822 635 22 45033 2 3 24 15 1 585 2832326 80 499271 110 192 6185 1752 302907 52967 3 3423576 5373 63 2196 35 113 1209 303 12 89 4572 4 13274 5867 10158 33467 3128 776575 59189 23 11698 637 3 330 1 1 18 3534 ...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
36 125 2 125 1 22 28253 125 125 70 28253 418 125 22 28253 2 3 24 15 1 125 28253 67 28253 67 67 1796 418 28253 28253 3 28253 1796 63 418 35 67 418 125 12 67 1655 4 5768 1796 3551 25961 418 28253 28253 23 4244 125 3 125 1 1 18 617 418 28253 28253 418 28253 1...

result:

ok 3 lines

Test #24:

score: 0
Accepted
time: 836ms
memory: 11944kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100...

result:

ok 3 lines

Subtask #5:

score: 33
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #25:

score: 33
Accepted
time: 38ms
memory: 7172kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
145225 31645 4 151743 10515 410786267 21 1015390 61045264 4131 1 3600349 333884 512525 19667335 135295668 31492443 2411991 321 15043178 339742 3465232 53388839 10861 1299 202884 868487178 11047003 18930665 1673 282292769 1520 95716039 1202719 18378639 ...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 3 lines

Test #26:

score: 0
Accepted
time: 275ms
memory: 8004kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
2000
6660729 331478508 2 6002 21493 1499573 2477187 138 8380029 211056984 215917 365962 15 19188779 5317 7401308 114667 1 767731 3075 11628943 16000 2 82718979 7 353766303 24028 167189905 5 34265 1670 10004827 336093 238 457970 127 7760 33566301 6073 400 4420...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
1071 471 0 348 14438 7653 15334 0 21997 19503 18841 9355 15 14692 3846 15570 10782 1 20346 3075 22605 5848 0 23453 0 30717 18799 35565 0 28586 413 22696 29186 0 26259 0 6540 24771 3439 0 19540 21443 24048 21720 18365 16478 0 15126 0 4112 0 14956 1473 0 0 0...

result:

ok 3 lines

Test #27:

score: 0
Accepted
time: 709ms
memory: 11820kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
107157 898755148 47 19541971 29895 7675722 30571642 293800776 56953 6307489 1290344 129635913 31725232 368416204 37408362 12 73 1193535 1601408 682299903 41 43 325856 14177 9 186733 151 134882 1 197073 3369082 41546 711876 53 7089 331184861 10 2 314 80...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 804 0 3331 2425 2230 3397 3747 3862 3862 3862 3700 4158 4158 3193 12 73 4544 5309 4132 41 43 6784 6877 9 9337 151 7650 1 5401 5868 6551 7739 53 6114 7114 10 2 314 7382 7990 180 9109 115 12 10198 11193 10343 564 9272 472 0 0 11084 7168 11352 10635 10339 8...

result:

ok 3 lines

Test #28:

score: 0
Accepted
time: 713ms
memory: 11928kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
11408901 370732653 37843 28 53693 15782410 103 297546 1112427 170319071 26 1 6172 11614171 431 884673599 1 3 50085 154 57 28200 145886 898969 74758 72 845768 6 69787 11 31012465 55362 253 2363145 47186217 1103 19622 594 7867 1 4299 28130 48 4689582 12 ...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
190872 190872 37843 28 53693 378297 103 297546 376950 334451 26 1 6172 456773 431 365002 1 3 50085 154 57 28200 145886 540424 74758 72 636444 6 69787 11 660676 55362 253 771004 852662 1103 19622 594 7867 1 4299 28130 48 927877 12 431 123 911053 4806 336 17...

result:

ok 3 lines

Test #29:

score: 0
Accepted
time: 692ms
memory: 11948kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
2 24047683 35956 5520372 249775 141535911 102290445 353 1 126 37 88600006 117 116 525267 10064887 13854 224 56 5924 13813388 30325052 109772567 375 14044887 4145 7 768367533 289 191791 5 76489 97 4122793 19776257 362801 5867119 616488 478058 254 640072...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 1020865 0 1487266 164783 3636676 3978597 353 1 126 37 3195384 117 116 116118 3697116 13854 224 56 5924 4736715 4736715 5392958 375 4507495 4145 7 3957463 289 116118 5 76489 97 1325048 4371720 116118 3069374 164554 116118 254 8636899 190 8485516 8250 7550...

result:

ok 3 lines

Test #30:

score: 0
Accepted
time: 697ms
memory: 11944kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
4706120 295 54515831 50 110400 53 104567978 5811776 30038529 3563 263 246095 194 134 31 16583964 3890 105612168 11320736 214 37264 12625 9250586 6 29 404581 40 229864 4 109 41325394 19 11212219 15 157 1992100 5531880 14848 1 106413 670105 99231667 1974...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 0 0 0 0 53 12100198 5531376 7321906 3563 263 246095 194 134 31 5132622 3890 5132622 5132622 214 37264 12625 5132622 6 29 404581 40 0 0 0 11072190 0 0 0 0 0 110133 0 0 0 0 45128232 0 0 0 5073702 0 0 65073712 0 0 85061909 0 0 28754807 0 0 62151653 0 0 0 0 ...

result:

ok 3 lines

Test #31:

score: 0
Accepted
time: 719ms
memory: 11900kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
305263 281 10690 235 990069 52806771 124403 6 22 4901 18 4667 1944046 163079 358062945 167 258980 119407 434894470 51581578 40072504 9499993 3863 1269 1659 3 4 954 67916 18536 57095396 7 19561069 6 51690 595643338 5 902269 249 15 4526 1326847 3474 4157...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
305263 281 0 0 0 0 0 0 0 4901 18 4667 1944046 163079 293408538 167 258980 119407 370240063 51581578 40072504 9499993 3863 1269 1659 3 4 954 67916 18536 57095396 7 19561069 6 51690 577723795 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 769842144 0 16807619 0 0 0...

result:

ok 3 lines