QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#305917#6544. Cooperation GameckisekiAC ✓421ms21576kbC++201.5kb2024-01-16 06:05:452024-01-16 06:05:46

Judging History

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

  • [2024-01-16 06:05:46]
  • 评测
  • 测评结果:AC
  • 用时:421ms
  • 内存:21576kb
  • [2024-01-16 06:05:45]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

class BIT {
    vector<int> a;
    static int lowbit(int x) { return x & (-x); }

    int query(int p) {
        int r = 0;
        while (p) {
            r += a[p];
            p -= lowbit(p);
        }
        return r;
    }

public:
    BIT(int n) : a(n + 1) {}
    void add(int p, int x) {
        while (p < a.size()) {
            a[p] += x;
            p += lowbit(p);
        }
    }
    int query(int l, int r) {
        return query(r) - query(l);
    }
};

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int t; cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        for (int &ai : a)
            cin >> ai;
        vector<vector<int>> p(n);
        for (int i = 0; i < n; ++i)
            p[a[i] - 1].push_back(i);
        vector<pair<int, int>> v;
        for (const auto &pi : p) {
            for (size_t i = 0; i < pi.size(); ++i) {
                if (pi.size() <= i + i + 1)
                    break;
                v.emplace_back(pi[pi.size() - i - 1] - pi[i], pi[i]);
            }
        }
        BIT bit(n);
        int64_t ans = 0;
        sort(v.begin(), v.end(), greater<>());
        for (auto [d, l] : v) {
            // [0, 1] -> [1, 2] -> (0, 2]
            // [l + 1, l + d - 1]
            ans += d - bit.query(l + 1, l + d);
            bit.add(l + 1, 1);
            bit.add(l + d + 1, 1);
        }
        cout << ans << '\n';
    }
    return 0;
}

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

详细

Test #1:

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

input:

2
7
1 2 1 1 2 1 2
12
1 2 3 1 2 3 1 2 3 1 2 3

output:

10
30

result:

ok 2 number(s): "10 30"

Test #2:

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

input:

1
7
1 2 1 1 2 1 2

output:

10

result:

ok 1 number(s): "10"

Test #3:

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

input:

1
12
1 2 3 1 2 3 1 2 3 1 2 3

output:

30

result:

ok 1 number(s): "30"

Test #4:

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

input:

1
5
1 1 1 1 1

output:

6

result:

ok 1 number(s): "6"

Test #5:

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

input:

1
5
1 2 2 2 2

output:

4

result:

ok 1 number(s): "4"

Test #6:

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

input:

1
5
1 2 4 1 4

output:

4

result:

ok 1 number(s): "4"

Test #7:

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

input:

1
6
6 2 3 1 5 5

output:

1

result:

ok 1 number(s): "1"

Test #8:

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

input:

1
7
3 3 4 1 2 1 7

output:

3

result:

ok 1 number(s): "3"

Test #9:

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

input:

1
8
6 7 1 8 2 2 4 4

output:

2

result:

ok 1 number(s): "2"

Test #10:

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

input:

1
9
2 2 5 6 3 4 6 8 9

output:

4

result:

ok 1 number(s): "4"

Test #11:

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

input:

1
10
10 1 2 2 8 4 4 7 1 5

output:

9

result:

ok 1 number(s): "9"

Test #12:

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

input:

1
11
10 3 4 11 10 11 8 11 6 1 11

output:

12

result:

ok 1 number(s): "12"

Test #13:

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

input:

1
12
5 9 9 1 11 11 10 3 5 7 6 6

output:

11

result:

ok 1 number(s): "11"

Test #14:

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

input:

1
13
6 2 11 7 1 5 9 2 3 7 10 11 4

output:

19

result:

ok 1 number(s): "19"

Test #15:

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

input:

1
14
7 3 11 12 7 13 3 2 7 5 2 10 5 1

output:

17

result:

ok 1 number(s): "17"

Test #16:

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

input:

1
15
9 12 8 12 2 13 9 14 15 3 7 9 15 1 11

output:

16

result:

ok 1 number(s): "16"

Test #17:

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

input:

1
16
16 1 14 7 3 2 13 1 9 10 14 10 9 12 9 8

output:

19

result:

ok 1 number(s): "19"

Test #18:

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

input:

1
17
3 1 10 8 15 1 15 13 10 3 3 8 14 11 12 13 16

output:

30

result:

ok 1 number(s): "30"

Test #19:

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

input:

1
18
6 15 12 8 13 8 10 11 15 14 1 17 16 11 14 16 18 17

output:

23

result:

ok 1 number(s): "23"

Test #20:

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

input:

1
15
1 1 2 1 2 2 2 2 2 1 2 1 1 1 2

output:

52

result:

ok 1 number(s): "52"

Test #21:

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

input:

1
16
3 2 1 3 2 2 1 3 3 1 2 2 1 1 2 1

output:

47

result:

ok 1 number(s): "47"

Test #22:

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

input:

1
17
1 1 1 1 1 2 1 1 2 1 1 1 1 2 1 2 2

output:

55

result:

ok 1 number(s): "55"

Test #23:

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

input:

1
18
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

output:

81

result:

ok 1 number(s): "81"

Test #24:

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

input:

1
18
2 1 1 2 2 2 2 2 2 2 1 2 2 2 1 1 1 2

output:

74

result:

ok 1 number(s): "74"

Test #25:

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

input:

1
18
3 3 3 2 1 3 2 2 3 2 3 3 2 2 3 1 2 2

output:

63

result:

ok 1 number(s): "63"

Test #26:

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

input:

1
500
137 146 125 351 189 109 382 104 211 422 391 129 256 490 177 460 366 191 205 75 84 65 93 417 61 47 453 206 261 243 286 263 314 431 295 423 285 201 195 47 435 60 88 219 12 224 23 50 351 286 325 315 388 113 135 262 389 390 187 211 21 18 150 460 452 391 80 174 281 474 471 423 298 456 260 279 316 3...

output:

23820

result:

ok 1 number(s): "23820"

Test #27:

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

input:

1
1000
356 859 87 222 368 232 533 255 448 434 593 395 634 828 364 790 146 262 851 257 619 11 964 699 802 713 125 523 395 45 773 304 73 900 97 98 634 579 673 278 553 985 280 29 891 567 999 117 346 871 218 823 829 642 177 599 510 368 489 984 850 180 961 205 181 78 277 617 636 255 863 208 728 984 929 4...

output:

94557

result:

ok 1 number(s): "94557"

Test #28:

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

input:

1
2000
126 1070 1218 159 394 609 1783 1957 1265 1242 359 303 692 1677 1379 932 1989 1331 1457 781 811 1528 1673 1240 1954 1612 824 887 824 1203 288 66 1074 1029 1894 1697 1685 718 323 1490 1341 255 1828 1849 1225 1867 1050 411 1452 1643 1019 1506 1006 555 687 924 26 250 483 396 1997 1150 746 1288 71...

output:

360267

result:

ok 1 number(s): "360267"

Test #29:

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

input:

1
3000
1705 281 2645 287 2932 2690 625 2763 2674 2154 2021 2316 749 1822 2882 1370 2832 2889 1359 1408 3 2238 2677 781 2210 911 1035 1652 1150 2361 1995 2723 1482 1350 1795 2591 927 857 782 599 424 1013 2185 861 2751 2359 2398 1513 854 415 2116 2597 1479 1572 2900 2849 837 621 2478 808 1657 312 42 1...

output:

887149

result:

ok 1 number(s): "887149"

Test #30:

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

input:

1
5000
2350 599 3307 3943 2600 1636 1526 2270 3605 474 153 4237 3056 3521 2207 2551 2918 1324 1058 2455 2579 681 1389 2263 1515 1109 2649 4292 3713 86 2433 1335 3083 1503 894 4085 3515 2647 2699 2816 1592 3746 4385 2181 1507 1342 285 3908 3171 4152 2013 2475 321 3501 3023 3291 1868 4873 571 4145 487...

output:

2222345

result:

ok 1 number(s): "2222345"

Test #31:

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

input:

1
5000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

6250000

result:

ok 1 number(s): "6250000"

Test #32:

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

input:

1
5000
1 2 1 2 1 1 1 1 2 2 2 1 2 2 2 1 2 1 1 2 2 1 2 1 1 1 2 2 1 2 2 2 1 1 2 2 2 1 1 1 1 1 2 1 1 1 2 2 2 1 2 2 2 1 1 1 1 2 1 2 2 1 1 2 1 1 1 2 1 1 1 2 2 1 1 1 1 2 1 1 1 2 2 2 1 2 2 2 1 2 2 2 1 1 1 1 2 2 2 1 1 2 1 1 1 2 1 2 1 2 1 2 1 1 1 1 1 1 1 2 2 2 2 1 2 1 1 1 1 1 1 1 1 1 1 2 1 2 2 1 2 2 1 1 2 2 1...

output:

6176349

result:

ok 1 number(s): "6176349"

Test #33:

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

input:

1
5000
1 3 3 2 2 1 1 3 3 1 1 1 3 3 3 2 1 1 2 3 2 3 1 1 1 1 1 2 2 2 2 3 3 3 3 3 1 1 2 2 2 2 3 3 1 1 2 3 1 2 1 2 3 2 1 2 3 1 1 1 2 1 3 3 1 3 3 2 2 1 2 2 2 2 1 2 3 1 3 1 3 3 1 1 1 3 3 1 3 3 2 1 2 3 1 2 2 3 1 2 2 1 1 1 3 1 1 1 2 2 3 1 3 1 2 3 1 2 1 2 1 3 1 3 1 1 2 3 2 1 3 2 3 3 3 2 1 1 3 1 1 1 1 2 2 1 2...

output:

6188117

result:

ok 1 number(s): "6188117"

Test #34:

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

input:

1
5000
3 1 3 1 2 2 1 1 1 2 2 4 4 4 2 4 1 1 3 3 1 1 2 3 1 3 4 4 2 4 3 1 1 1 1 2 3 1 4 4 2 4 4 4 3 2 3 4 2 1 2 1 1 2 1 4 1 4 3 4 3 1 3 2 4 4 4 1 1 1 2 3 4 4 3 2 2 2 3 3 3 2 1 2 1 2 4 3 1 3 2 3 3 1 4 2 3 4 4 3 3 4 1 3 2 2 3 2 1 1 4 4 4 2 4 1 1 4 3 1 1 4 2 1 1 2 1 4 2 3 3 3 1 1 4 2 4 2 2 4 4 1 1 3 1 4 4...

output:

6160622

result:

ok 1 number(s): "6160622"

Test #35:

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

input:

1
5000
5 1 1 5 3 3 5 1 3 3 1 4 2 1 1 3 2 1 3 2 2 1 1 3 2 4 1 2 4 1 3 5 5 1 4 4 5 3 4 4 1 5 2 3 4 3 5 5 4 4 1 4 4 5 5 3 1 1 4 2 3 2 3 4 1 3 3 1 2 5 2 5 2 5 4 1 5 4 1 4 5 2 5 2 1 3 4 2 4 3 1 2 2 4 4 4 4 1 2 1 1 5 5 3 2 5 4 5 5 4 3 3 5 4 5 4 3 3 1 2 5 3 5 5 3 5 2 3 3 4 3 5 1 3 2 3 4 4 5 2 3 4 1 1 1 1 3...

output:

6143208

result:

ok 1 number(s): "6143208"

Test #36:

score: 0
Accepted
time: 8ms
memory: 5660kb

input:

1
50000
14319 5515 19656 16731 116 13372 1204 4497 18199 2381 17358 14883 12446 8351 17368 14809 2695 3878 15368 12082 1952 9676 15080 15810 3564 13037 9685 4878 2436 1242 10465 1394 19891 18070 9586 8475 10745 7996 4320 10318 14442 247 10234 12831 19596 14279 13570 14555 6012 4163 17580 17118 4330 ...

output:

350726492

result:

ok 1 number(s): "350726492"

Test #37:

score: 0
Accepted
time: 16ms
memory: 7720kb

input:

1
100000
21754 27048 9891 6525 24522 9160 19237 22607 25962 990 3621 18344 24028 1096 15056 27867 16485 25458 5796 20163 14399 20992 2902 28203 13144 7416 28669 19684 28274 24581 20612 12530 1025 13557 18220 4335 28448 18364 15799 14023 9372 4047 17262 13131 4151 970 23261 4270 20599 4059 23922 1063...

output:

1525230220

result:

ok 1 number(s): "1525230220"

Test #38:

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

input:

1
200000
38483 10514 31812 19484 36945 2891 23483 3223 9429 18651 14138 12335 19265 35958 13423 25907 27820 34082 17594 13957 36130 10236 16879 8281 26592 9843 5272 12986 12313 12556 34929 12934 24563 1372 35946 35629 27275 22929 2793 23221 1965 42 39173 2681 34076 5754 24268 4261 6608 10345 28606 2...

output:

6750198055

result:

ok 1 number(s): "6750198055"

Test #39:

score: 0
Accepted
time: 50ms
memory: 19416kb

input:

1
300000
151794 116542 170886 235225 187763 184678 84510 217467 113166 229754 133167 123059 156441 173838 15120 220551 161229 1624 218845 290782 294345 57749 200471 131014 63919 181251 251329 99952 15494 142021 183236 115922 168694 249731 68716 299716 272911 252775 89064 89956 110722 2944 190702 113...

output:

8427945711

result:

ok 1 number(s): "8427945711"

Test #40:

score: 0
Accepted
time: 41ms
memory: 18288kb

input:

1
300000
164383 37078 172493 81232 164504 28942 155669 114157 106355 22598 129364 137766 195743 122628 55572 188911 179936 10439 120050 25517 135629 105725 40543 104508 2643 114830 148387 38634 134704 21008 151125 106553 26297 23184 145380 133089 10068 132111 195153 188363 102335 103746 108210 18946...

output:

10264263234

result:

ok 1 number(s): "10264263234"

Test #41:

score: 0
Accepted
time: 42ms
memory: 17264kb

input:

1
300000
1165 718 6804 27239 32734 97399 26828 35039 42648 39633 92857 43961 91941 71418 6424 48759 22835 53845 88550 60253 9617 20998 47912 86514 51766 56920 36932 44611 21211 91482 51718 97184 16603 20829 97852 66461 14522 21848 1242 54067 85435 4549 25719 75388 11593 72193 91758 19194 12143 98447...

output:

13327909467

result:

ok 1 number(s): "13327909467"

Test #42:

score: 0
Accepted
time: 45ms
memory: 16376kb

input:

1
300000
11020 30876 5221 9739 26264 43919 10432 19646 14383 3608 1951 23623 27606 28115 9086 21243 26052 11218 17903 24647 7860 43672 45049 44168 21527 14975 34980 38993 37840 13234 11950 46441 16614 39187 16777 1114 22997 14790 37082 42419 37261 28740 27980 36423 49810 49050 29467 31548 39914 1933...

output:

15785962088

result:

ok 1 number(s): "15785962088"

Test #43:

score: 0
Accepted
time: 22ms
memory: 15448kb

input:

1
300000
2 4 4 6 2 8 9 5 1 9 6 1 7 2 2 8 1 2 6 9 8 3 10 3 6 4 9 2 5 10 2 3 10 1 7 9 5 3 9 5 3 10 8 4 8 4 1 4 5 4 8 3 8 8 5 10 2 7 3 2 10 9 9 2 4 10 1 4 3 1 1 7 9 2 5 7 4 3 6 8 9 2 9 9 4 8 7 2 2 9 2 1 2 3 2 7 2 9 3 9 1 5 9 4 7 1 4 6 10 9 3 4 6 9 4 3 8 7 5 4 7 6 3 8 2 4 1 3 3 3 9 9 1 1 7 7 10 9 2 9 8 ...

output:

22430811852

result:

ok 1 number(s): "22430811852"

Test #44:

score: 0
Accepted
time: 25ms
memory: 15224kb

input:

1
300000
5 4 3 1 2 3 2 2 2 1 1 1 2 5 4 5 3 1 1 3 1 5 4 1 2 4 5 1 4 2 3 3 3 3 4 5 5 4 2 5 3 1 4 2 4 1 5 1 4 1 5 5 4 4 5 4 3 5 1 1 3 1 4 3 4 4 4 3 2 3 3 2 1 1 4 3 4 3 2 1 4 4 2 4 4 4 1 1 4 3 4 5 2 4 2 3 2 4 3 5 1 4 5 1 2 5 5 5 5 4 2 3 5 4 1 5 5 3 3 2 2 3 2 3 4 3 1 5 5 5 5 5 3 2 4 1 2 4 1 2 3 2 2 2 4 2...

output:

22447235134

result:

ok 1 number(s): "22447235134"

Test #45:

score: 0
Accepted
time: 19ms
memory: 15100kb

input:

1
300000
4 1 1 2 3 3 4 1 4 4 1 4 4 3 4 2 1 4 3 1 3 3 1 2 3 2 2 2 4 2 1 3 1 1 1 3 4 3 4 1 2 4 3 1 4 4 4 4 4 4 3 3 2 2 2 3 3 1 4 3 2 2 2 3 2 4 1 1 1 1 1 3 4 3 1 4 4 4 1 1 3 2 3 2 1 4 2 3 4 3 2 4 4 1 2 1 3 2 1 2 2 2 2 3 2 4 4 2 1 2 2 4 2 2 3 4 4 3 3 1 4 3 1 2 3 2 3 1 1 1 1 1 4 4 3 2 1 3 2 1 1 2 3 2 2 1...

output:

22473048659

result:

ok 1 number(s): "22473048659"

Test #46:

score: 0
Accepted
time: 23ms
memory: 15132kb

input:

1
300000
1 3 1 1 3 1 1 3 3 1 3 3 1 1 1 2 2 1 3 2 1 1 2 1 1 2 2 1 1 2 1 2 1 1 3 1 2 3 2 2 1 1 1 3 2 3 1 2 3 3 2 1 2 3 1 2 3 2 3 3 1 1 3 3 1 3 2 1 2 2 3 3 1 3 3 3 2 3 2 3 1 1 3 2 3 2 1 1 1 3 2 2 3 2 1 1 2 2 2 1 1 2 2 1 3 2 3 1 2 2 2 2 3 3 3 3 1 3 3 3 3 1 1 3 3 1 2 3 3 2 2 1 1 3 2 1 3 2 2 1 3 1 1 3 1 3...

output:

22477684306

result:

ok 1 number(s): "22477684306"

Test #47:

score: 0
Accepted
time: 29ms
memory: 15164kb

input:

1
300000
2 2 2 1 2 1 2 1 1 2 2 1 2 2 2 2 2 2 1 2 2 2 1 2 1 1 2 2 1 1 1 2 1 1 1 2 2 1 1 1 2 1 1 2 1 1 1 1 2 1 1 1 1 2 2 1 2 1 2 1 1 2 1 1 1 2 1 2 1 1 1 2 2 2 1 2 2 2 1 2 2 2 2 2 1 2 1 2 2 1 1 1 2 1 2 2 1 1 1 1 2 1 2 1 2 2 2 2 2 1 1 1 2 1 1 2 1 2 2 1 1 2 1 1 2 1 1 2 2 2 1 1 1 2 2 1 2 1 2 2 1 1 1 2 1 1...

output:

22493143665

result:

ok 1 number(s): "22493143665"

Test #48:

score: 0
Accepted
time: 15ms
memory: 15540kb

input:

1
300000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

22500000000

result:

ok 1 number(s): "22500000000"

Test #49:

score: 0
Accepted
time: 29ms
memory: 15264kb

input:

1
300000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

16875000000

result:

ok 1 number(s): "16875000000"

Test #50:

score: 0
Accepted
time: 421ms
memory: 21576kb

input:

48
7
1 2 1 1 2 1 2
12
1 2 3 1 2 3 1 2 3 1 2 3
5
1 1 1 1 1
5
1 2 2 2 2
5
1 2 4 1 4
6
6 2 3 1 5 5
7
3 3 4 1 2 1 7
8
6 7 1 8 2 2 4 4
9
2 2 5 6 3 4 6 8 9
10
10 1 2 2 8 4 4 7 1 5
11
10 3 4 11 10 11 8 11 6 1 11
12
5 9 9 1 11 11 10 3 5 7 6 6
13
6 2 11 7 1 5 9 2 3 7 10 11 4
14
7 3 11 12 7 13 3 2 7 5 2 10 5 ...

output:

10
30
6
4
4
1
3
2
4
9
12
11
19
17
16
19
30
23
52
47
55
81
74
63
23820
94557
360267
887149
2222345
6250000
6176349
6188117
6160622
6143208
350726492
1525230220
6750198055
8427945711
10264263234
13327909467
15785962088
22430811852
22447235134
22473048659
22477684306
22493143665
22500000000
16875000000

result:

ok 48 numbers