QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#438122#8645. Growing Vegetables is Fun 5nhuang685100 ✓1695ms30436kbC++202.8kb2024-06-10 08:46:302024-06-10 08:46:31

Judging History

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

  • [2024-06-10 08:46:31]
  • 评测
  • 测评结果:100
  • 用时:1695ms
  • 内存:30436kb
  • [2024-06-10 08:46:30]
  • 提交

answer

/**
 * @file qoj8645-3.cpp
 * @author n685
 * @brief
 * @date 2024-06-09
 *
 *
 */
#include <bits/stdc++.h>

#ifdef LOCAL
#include "dd/debug.h"
#else
#define dbg(...) 42
#define dbgR(...) 4242
#define dbgP(...) 420
#define dbgRP(...) 420420
void nline() {}
#endif

auto solve(int n, std::vector<int64_t> a, std::vector<int64_t> b,
           int64_t k) -> std::vector<bool> {
  std::vector<int> ii(n + 1);
  int lb = 0, rb = -1, r = 2 * n - 1;
  for (int i = 0; i < n; ++i) {
    while (lb < n && b[lb] < a[i] - k) {
      ++lb;
    }
    ++rb;
    while (rb < n && b[rb] <= a[i] + k) {
      ++rb;
    }
    --rb;
    while (a[r] < a[i]) {
      --r;
    }
    int least = i + n - r - 1;
    if (rb < least) {
      continue;
    }
    int ll = std::max(0, i - rb);
    int rr = (lb <= least ? i : i - lb);
    if (ll <= rr) {
      ii[ll]++;
      ii[rr + 1]--;
    }
  }
  lb = 0, rb = -1, r = 0;
  for (int i = 2 * n - 1; i >= n; --i) {
    while (lb < n && b[lb] < a[i] - k) {
      ++lb;
    }
    ++rb;
    while (rb < n && b[rb] <= a[i] + k) {
      ++rb;
    }
    --rb;
    while (r < n && a[r] <= a[i]) {
      ++r;
    }
    int least = r - (i - n) - 1;
    if (rb < least) {
      continue;
    }
    int ll = (lb <= least ? i - n + 1 : lb + i - n + 1);
    int rr = std::min(n - 1, rb + i - n + 1);
    if (ll <= rr) {
      ii[ll]++;
      ii[rr + 1]--;
    }
  }
  std::vector<bool> ans(n);
  for (int i = 0; i < n; ++i) {
    if (i > 0) {
      ii[i] += ii[i - 1];
    }
    ans[i] = (ii[i] == n);
  }
  return ans;
}

auto main() -> int {
#ifndef LOCAL
  std::cin.tie(nullptr)->sync_with_stdio(false);
#endif

  int n;
  std::cin >> n;
  std::vector<int64_t> a(2 * n), b(n), c(n);
  for (auto &i : a) {
    std::cin >> i;
  }
  for (auto &i : b) {
    std::cin >> i;
  }
  for (auto &i : c) {
    std::cin >> i;
  }
  std::sort(b.begin(), b.end());
  std::sort(c.begin(), c.end());
  std::vector<int64_t> a2 = a, b2 = b, c2 = c;
  std::rotate(a2.begin(), a2.begin() + n, a2.end());
  std::reverse(b2.begin(), b2.end());
  std::reverse(c2.begin(), c2.end());
  for (auto &i : a2) {
    i = -i;
  }
  for (auto &i : b2) {
    i = -i;
  }
  for (auto &i : c2) {
    i = -i;
  }
  auto good = [&](int64_t k) {
    std::vector<bool> r1 = solve(n, a, b, k), r2 = solve(n, a2, c2, k);
    std::vector<bool> r3 = solve(n, a, c, k), r4 = solve(n, a2, b2, k);
    for (int i = 0; i < n; ++i) {
      if ((r1[i] && r2[i]) || (r3[i] && r4[i])) {
        return true;
      }
    }
    return false;
  };
  int64_t l = 0, r = static_cast<int64_t>(1e9);
  while (l < r) {
    int64_t mid = (l + r) / 2;
    if (good(mid)) {
      r = mid;
    } else {
      l = mid + 1;
    }
  }
  std::cout << l << '\n';
}

詳細信息

Subtask #1:

score: 4
Accepted

Test #1:

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

input:

5
71039844 102827355 217531548 220229557 237972610 314010999 309303025 282414480 227324750 127910276
355992665 573821998 974848115 193721993 786455947
602158296 281786121 321727541 140763116 455641294

output:

660837116

result:

ok single line: '660837116'

Test #2:

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

input:

4
1705 9199 9245 9297 9785 8486 3596 2031
356 2834 9555 4667
1881 4772 9778 4863

output:

4427

result:

ok single line: '4427'

Test #3:

score: 4
Accepted
time: 1ms
memory: 3528kb

input:

3
1 1 1 1 1 1
6 4 7
4 2 6

output:

6

result:

ok single line: '6'

Test #4:

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

input:

2
2 2 10 6
9 2
9 2

output:

3

result:

ok single line: '3'

Test #5:

score: 4
Accepted
time: 1ms
memory: 3616kb

input:

1
349142605 778700270
168051580
502698453

output:

276001817

result:

ok single line: '276001817'

Test #6:

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

input:

5
17 17 18 18 19 20 19 19 18 17
16 21 17 15 22
16 15 12 17 19

output:

5

result:

ok single line: '5'

Test #7:

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

input:

5
4 7 8 8 9 9 8 5 5 4
8 5 6 6 9
7 7 8 1 7

output:

3

result:

ok single line: '3'

Test #8:

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

input:

4
6 7 8 8 10 10 8 7
10 9 4 6
6 6 8 7

output:

2

result:

ok single line: '2'

Test #9:

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

input:

5
1 285389468 292069311 556395360 725450787 931668868 448264980 368730609 214990111 201747487
1000000000 1000000000 1000000000 1000000000 1000000000
1000000000 1000000000 1000000000 1000000000 1000000000

output:

999999999

result:

ok single line: '999999999'

Test #10:

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

input:

5
662886918 684753078 783767220 920694140 923464013 1000000000 885337163 779952619 739901312 687764518
1 1 1 1 1
1 1 1 1 1

output:

999999999

result:

ok single line: '999999999'

Test #11:

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

input:

5
463408857 467609229 473997928 477395329 481525188 519068288 507259005 493795251 483097019 477045791
467609229 481525188 463408857 477395329 473997928
483097019 493795251 507259005 519068288 477045791

output:

0

result:

ok single line: '0'

Test #12:

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

input:

3
1 3 5 6 4 2
2 3 4
5 6 7

output:

1

result:

ok single line: '1'

Subtask #2:

score: 5
Accepted

Dependency #1:

100%
Accepted

Test #13:

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

input:

10
773135427 774332767 785123517 817394834 818143902 821137578 833844052 845124168 848733309 857691141 862029826 854157076 847018323 843060840 826855175 800318737 796404138 789256510 783695157 776861639
403498898 659393782 937645583 797482218 969577314 91539882 712627349 314393029 277704717 44148171...

output:

748030905

result:

ok single line: '748030905'

Test #14:

score: 5
Accepted
time: 0ms
memory: 3620kb

input:

9
2058 3355 3467 4778 5458 5969 6041 6118 7343 8215 8122 6915 6167 6012 5563 4897 4206 2499
4946 4522 9879 3499 4152 4279 3059 3530 7545
5485 9668 3847 1946 2897 5648 3124 8377 9390

output:

2259

result:

ok single line: '2259'

Test #15:

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

input:

8
1 1 2 5 6 7 8 10 10 7 5 5 5 4 2 1
1 7 4 2 5 2 7 9
7 9 8 1 6 8 4 10

output:

2

result:

ok single line: '2'

Test #16:

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

input:

10
28 29 31 31 33 34 37 37 39 40 50 49 48 42 39 34 33 30 29 28
34 34 26 29 35 32 32 23 31 33
47 40 38 50 47 41 44 40 30 30

output:

5

result:

ok single line: '5'

Test #17:

score: 5
Accepted
time: 0ms
memory: 3608kb

input:

10
2 4 6 7 10 12 14 17 19 21 21 20 16 12 12 11 10 9 6 5
6 16 21 2 5 8 10 12 14 15
2 16 4 3 20 13 13 18 3 19

output:

4

result:

ok single line: '4'

Test #18:

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

input:

9
1 1 1 2 2 3 3 3 5 5 4 3 3 3 2 2 2 1
5 1 8 8 1 3 1 1 2
2 2 1 3 1 4 2 5 5

output:

3

result:

ok single line: '3'

Test #19:

score: 5
Accepted
time: 0ms
memory: 3824kb

input:

8
15 15 15 16 16 17 18 19 19 18 17 17 17 17 16 15
11 12 24 13 22 15 13 15
11 21 21 14 9 16 17 18

output:

6

result:

ok single line: '6'

Test #20:

score: 5
Accepted
time: 0ms
memory: 3648kb

input:

10
1 13280914 96613242 127812270 158437352 259641463 436482346 505230087 549623141 554037556 590408520 388492212 334223975 312683258 264691487 217880860 193182063 174018234 171453258 147939223
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10000000...

output:

999999999

result:

ok single line: '999999999'

Test #21:

score: 5
Accepted
time: 0ms
memory: 3824kb

input:

10
326424629 353378674 597744285 634314932 677996941 757848432 769253696 942511855 949304023 988319620 1000000000 868204345 842188353 821725662 716151066 631684281 559658741 511768003 456818334 357276475
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1

output:

999999999

result:

ok single line: '999999999'

Test #22:

score: 5
Accepted
time: 0ms
memory: 3536kb

input:

10
57143744 133393297 398910072 401484623 474217555 757601927 774658022 800636343 849390123 876553996 920840636 769125109 719072497 523840378 481733548 355770208 344383282 310868559 234051801 173516705
133393297 474217555 173516705 234051801 398910072 57143744 310868559 757601927 344383282 401484623...

output:

0

result:

ok single line: '0'

Test #23:

score: 5
Accepted
time: 1ms
memory: 3564kb

input:

10
63403651 210510858 210510858 210510858 210510858 210510858 210510858 210510858 210510858 210510858 225130956 210510858 210510858 210510858 210510858 210510858 210510858 210510858 210510858 210510858
236486230 236486230 236486230 236486230 236486230 89379023 236486230 236486230 236486230 236486230...

output:

25975372

result:

ok single line: '25975372'

Test #24:

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

input:

10
1 3 5 7 9 11 13 15 17 19 20 18 16 14 12 10 8 6 4 2
2 3 4 5 6 7 8 9 10 11
12 13 14 15 16 17 18 19 20 21

output:

1

result:

ok single line: '1'

Test #25:

score: 5
Accepted
time: 0ms
memory: 3616kb

input:

9
1 3 5 7 9 11 13 15 17 18 16 14 12 10 8 6 4 2
2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19

output:

1

result:

ok single line: '1'

Subtask #3:

score: 21
Accepted

Dependency #2:

100%
Accepted

Test #26:

score: 21
Accepted
time: 7ms
memory: 3728kb

input:

2000
190093831 190101306 190130208 190130264 190130464 190142913 190155510 190186226 190187425 190239978 190246876 190313521 190318845 190368652 190389086 190397011 190398293 190400652 190406542 190410139 190449447 190459539 190491822 190510982 190539531 190561710 190579926 190592705 190592734 19059...

output:

768578381

result:

ok single line: '768578381'

Test #27:

score: 21
Accepted
time: 8ms
memory: 3948kb

input:

2000
330367 330422 330476 330535 330735 331208 331362 331437 331560 331800 332021 332053 332069 332174 332283 332359 332441 332478 332598 332682 332765 333155 333207 333367 333743 334103 334346 334637 335113 335124 335392 335481 335720 335808 335841 335909 336397 336553 336605 337089 337300 337645 3...

output:

361152

result:

ok single line: '361152'

Test #28:

score: 21
Accepted
time: 4ms
memory: 3740kb

input:

1999
6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 1...

output:

36

result:

ok single line: '36'

Test #29:

score: 21
Accepted
time: 1ms
memory: 3532kb

input:

100
17 17 17 18 18 18 18 20 20 20 21 21 21 23 23 24 24 25 25 25 26 26 26 26 26 26 27 27 28 28 28 28 28 29 29 29 30 30 31 33 33 34 35 35 36 36 37 37 38 38 38 39 39 39 39 39 39 40 40 40 40 40 41 41 41 41 42 42 42 42 42 44 45 46 46 46 47 47 47 48 48 48 48 48 49 49 49 50 50 50 51 52 52 52 53 53 53 53 54...

output:

45

result:

ok single line: '45'

Test #30:

score: 21
Accepted
time: 10ms
memory: 3972kb

input:

2000
350843244 350878017 350923036 351063064 351209654 351211808 351254174 351613048 352015188 352553488 352624700 352652270 352679713 352932525 353197312 353246919 353252277 353271126 353457632 353602903 353783914 353850160 354018331 354311288 354648146 354913061 355167810 355196919 355347509 35544...

output:

31621

result:

ok single line: '31621'

Test #31:

score: 21
Accepted
time: 6ms
memory: 4024kb

input:

1999
43596 43600 43606 43623 43653 43668 43706 43737 43794 43795 43814 43827 43828 43830 43843 43851 43866 43874 43884 43921 43938 43957 43958 44031 44040 44060 44061 44072 44075 44075 44102 44141 44142 44158 44167 44179 44221 44224 44232 44253 44264 44279 44280 44297 44304 44308 44310 44331 44350 4...

output:

244

result:

ok single line: '244'

Test #32:

score: 21
Accepted
time: 3ms
memory: 3736kb

input:

1001
6315 6315 6316 6316 6316 6316 6317 6317 6317 6317 6317 6318 6318 6318 6318 6318 6318 6318 6319 6319 6319 6319 6320 6320 6322 6322 6322 6323 6323 6325 6325 6325 6326 6326 6326 6326 6327 6327 6328 6328 6328 6328 6329 6329 6330 6330 6330 6330 6331 6331 6332 6332 6332 6332 6333 6333 6333 6333 6334 ...

output:

98

result:

ok single line: '98'

Test #33:

score: 21
Accepted
time: 2ms
memory: 3820kb

input:

500
259 259 259 266 269 270 272 274 274 276 276 282 286 286 289 289 290 291 293 295 297 297 299 300 301 303 303 307 307 308 310 310 311 312 314 314 317 317 318 321 322 323 324 326 327 329 330 330 330 330 331 332 333 333 334 336 338 338 339 340 340 342 346 352 353 355 356 356 360 360 361 362 362 362 ...

output:

26

result:

ok single line: '26'

Test #34:

score: 21
Accepted
time: 3ms
memory: 3788kb

input:

2000
1 60 72859 154827 236884 325052 436400 473708 549118 808443 833282 932599 973136 1129201 1147009 1192152 1452828 1468248 1582413 1600307 1674529 1677758 1724718 1747870 1757548 1813461 1874237 2024621 2187224 2213059 2291067 2296273 2392518 2416236 2478154 2524630 2592789 2630087 2689614 273165...

output:

999999999

result:

ok single line: '999999999'

Test #35:

score: 21
Accepted
time: 6ms
memory: 3712kb

input:

1998
133393383 133932583 134243854 134551224 134843355 135608488 136534290 136614639 136967781 136996872 137191496 137324480 137515794 137853863 138077590 138098732 138578175 138662365 139574744 139790753 139991134 140269877 141046757 141283120 141291469 141550391 141812143 142528647 143114802 14381...

output:

999999999

result:

ok single line: '999999999'

Test #36:

score: 21
Accepted
time: 6ms
memory: 3804kb

input:

2000
12508505 13182646 13817037 13971021 14561541 14977589 15006750 15065860 15185281 15330435 15344599 15896759 16096817 16123555 16226379 16404245 16454896 16918885 17316938 17615566 17928228 18112068 18317986 18362964 18446475 18595621 18909471 19078393 19268167 19486182 19595497 21078646 2161024...

output:

0

result:

ok single line: '0'

Test #37:

score: 21
Accepted
time: 3ms
memory: 3788kb

input:

2000
100727793 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 144308464 14430...

output:

17421808

result:

ok single line: '17421808'

Test #38:

score: 21
Accepted
time: 4ms
memory: 3712kb

input:

1998
32025041 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 42353890 4235389...

output:

150822514

result:

ok single line: '150822514'

Test #39:

score: 21
Accepted
time: 4ms
memory: 3804kb

input:

1999
505492694 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 511367919 528448976 528448976 528448976 52844...

output:

281897757

result:

ok single line: '281897757'

Test #40:

score: 21
Accepted
time: 1ms
memory: 3948kb

input:

1999
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 173 17...

output:

1

result:

ok single line: '1'

Subtask #4:

score: 37
Accepted

Test #41:

score: 37
Accepted
time: 1098ms
memory: 30368kb

input:

300000
619 2319 3493 3715 4353 4926 8022 14367 18919 23666 25565 25582 27245 27303 28880 29568 29918 31815 34986 36861 40022 40147 47041 52120 55624 57816 58553 59319 60056 63512 66442 68907 68915 69471 69714 71129 76758 76761 77220 78196 84558 87950 88697 88782 89810 90113 92091 95040 97273 99148 1...

output:

167936427

result:

ok single line: '167936427'

Test #42:

score: 37
Accepted
time: 887ms
memory: 30180kb

input:

299999
2 3 4 7 8 9 13 16 17 18 20 22 24 25 30 31 32 33 34 35 36 39 40 41 42 45 49 50 57 59 61 62 63 64 65 66 67 68 71 72 77 79 80 84 85 89 90 92 93 95 96 99 100 103 104 105 108 110 113 117 118 119 122 123 126 127 130 131 132 133 134 135 140 143 146 148 151 152 153 154 155 158 160 161 164 168 169 173...

output:

167225

result:

ok single line: '167225'

Test #43:

score: 37
Accepted
time: 711ms
memory: 25752kb

input:

250000
1 2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 22 23 24 25 26 29 30 31 32 33 34 35 37 39 40 41 42 44 47 48 49 50 52 53 54 55 56 57 59 60 61 63 64 65 66 67 68 69 70 72 73 74 75 76 77 78 80 81 82 83 84 86 87 88 89 90 91 92 95 96 97 98 99 100 101 102 103 104 105 106 107 109 110 112 113 114 1...

output:

100064

result:

ok single line: '100064'

Test #44:

score: 37
Accepted
time: 1042ms
memory: 30328kb

input:

300000
23 1084 4990 10033 10275 11917 12338 13780 18890 21272 21287 21541 21896 22307 22962 22994 28256 30306 35312 35789 37839 38480 40782 42608 43133 44514 46423 48426 50048 50896 51222 52721 53509 54878 56681 57093 58204 58476 58661 60138 66569 67553 68133 69448 71250 71855 72194 74345 74986 7503...

output:

26693

result:

ok single line: '26693'

Test #45:

score: 37
Accepted
time: 835ms
memory: 30260kb

input:

299998
2 3 4 5 7 9 10 12 14 15 17 19 20 24 28 30 31 32 33 35 36 41 43 44 45 46 47 48 50 51 53 54 57 58 60 61 62 63 66 67 68 69 71 72 73 74 75 77 80 81 83 84 88 90 94 96 97 99 100 101 102 104 105 106 108 110 111 113 115 117 119 120 122 123 124 125 126 127 128 130 131 132 133 134 135 136 137 138 140 1...

output:

982

result:

ok single line: '982'

Test #46:

score: 37
Accepted
time: 26ms
memory: 4108kb

input:

10000
13 34 36 45 54 59 60 62 70 73 84 85 87 89 93 95 100 101 102 104 107 110 114 115 118 128 131 132 140 143 144 147 150 151 152 154 160 164 168 183 187 190 195 196 215 217 222 237 241 251 252 256 257 262 268 269 279 285 290 293 298 299 303 304 312 313 316 323 328 329 330 331 336 342 347 351 352 35...

output:

285

result:

ok single line: '285'

Test #47:

score: 37
Accepted
time: 470ms
memory: 30132kb

input:

300000
1 473 3697 6630 7286 7657 9952 10287 11421 11877 12279 22156 29205 29365 29728 32757 33840 34011 34035 34229 35784 38558 39120 39894 40570 45844 46178 46806 51591 51960 55120 56505 59846 61666 65606 65795 67810 70418 70673 73000 76935 79219 79828 80316 80379 81725 83712 85781 88372 88526 8906...

output:

999999999

result:

ok single line: '999999999'

Test #48:

score: 37
Accepted
time: 444ms
memory: 30124kb

input:

300000
1295 1895 2725 3380 3426 7383 7395 8653 8775 13383 16038 21381 23341 24361 29918 30428 31274 31780 32932 33929 34648 35318 36424 39153 40615 42732 43263 44253 44641 45150 45181 47584 48740 48776 52807 53912 53981 54890 55260 57440 57974 60067 60378 62706 63469 65268 66129 66349 70951 71022 71...

output:

999999999

result:

ok single line: '999999999'

Test #49:

score: 37
Accepted
time: 843ms
memory: 30328kb

input:

300000
2915 7306 9074 9545 11829 14083 15092 15987 19985 21298 22831 24072 24289 25200 27940 29326 30028 31704 32095 33067 38446 39400 39983 41100 41956 42126 46127 46132 47577 49880 50711 52104 52900 54116 55805 57277 59116 62357 65455 66036 68185 71566 74707 75419 77086 82585 83076 85456 86516 945...

output:

0

result:

ok single line: '0'

Test #50:

score: 37
Accepted
time: 1005ms
memory: 30436kb

input:

300000
3734 4059 4299 8744 9042 11200 11942 14293 15399 15809 18600 21612 25564 25979 27179 29385 31106 35067 36441 36869 41081 42148 43026 43398 46160 46622 50163 51319 51961 52012 59052 61212 61512 63247 65689 67224 67859 68268 69723 70709 71556 71624 71894 73600 74439 75304 75549 76030 80615 8115...

output:

100007

result:

ok single line: '100007'

Test #51:

score: 37
Accepted
time: 1018ms
memory: 30320kb

input:

299998
432 1412 4873 6571 7309 12551 12734 14732 15371 15438 15548 17297 18854 20451 20775 21337 21678 25482 26393 27023 27624 29195 30972 31555 32520 32897 32939 33759 36460 37924 39012 40803 42086 42848 44784 46053 47197 49089 49218 49887 53402 54204 54956 55068 55685 56929 58263 59160 60732 60891...

output:

100007

result:

ok single line: '100007'

Test #52:

score: 37
Accepted
time: 895ms
memory: 30204kb

input:

300000
6 47 48 73 77 80 84 92 97 110 121 126 206 210 226 243 245 247 249 250 269 298 301 305 308 319 320 348 363 375 379 401 404 475 492 496 539 540 544 559 568 589 598 629 650 669 674 702 726 734 775 776 803 805 828 834 855 887 903 904 907 985 986 1005 1038 1068 1075 1082 1084 1092 1131 1136 1157 1...

output:

100007

result:

ok single line: '100007'

Test #53:

score: 37
Accepted
time: 827ms
memory: 30324kb

input:

300000
1 2 3 6 9 11 13 14 19 20 23 25 26 27 28 30 31 33 34 36 38 39 40 42 43 44 45 46 47 48 49 50 51 52 53 57 58 59 61 63 64 66 68 69 72 73 74 75 76 78 79 80 81 82 84 86 87 88 89 90 91 92 93 95 99 101 102 104 105 106 110 112 114 115 121 122 123 128 129 131 132 133 134 136 138 139 140 142 143 144 146...

output:

100007

result:

ok single line: '100007'

Test #54:

score: 37
Accepted
time: 514ms
memory: 30200kb

input:

300000
417 4951 13971 15437 15471 15664 17651 21576 23240 25724 28611 28771 30770 30798 31848 33007 36175 36934 37324 39752 40791 41422 41592 42971 44539 45026 46702 48168 51631 56662 57901 58708 60804 63166 63192 65791 67031 67106 67883 68505 70865 71954 74368 74787 75235 75324 76773 78080 78122 78...

output:

192337248

result:

ok single line: '192337248'

Test #55:

score: 37
Accepted
time: 462ms
memory: 30152kb

input:

300000
1 2 3 4 5 6 7 10 11 12 13 14 15 17 18 20 21 22 23 26 31 33 34 37 39 41 45 47 48 49 50 51 53 54 55 56 58 59 60 61 62 65 66 67 73 75 77 78 79 81 82 83 85 88 89 91 97 98 100 101 102 103 104 107 108 111 112 113 114 115 116 118 119 120 123 126 131 133 134 135 136 138 139 140 141 144 145 147 149 15...

output:

301854

result:

ok single line: '301854'

Test #56:

score: 37
Accepted
time: 471ms
memory: 30176kb

input:

300000
1 2 3 4 5 6 7 8 9 12 21 22 23 25 27 28 32 36 37 38 40 42 43 45 48 49 50 53 54 55 58 59 60 61 62 63 64 68 69 71 74 76 77 79 80 81 82 84 86 89 91 93 95 96 97 98 99 100 101 102 103 104 105 108 110 112 113 114 115 116 117 118 120 122 123 124 125 126 128 131 133 134 136 139 140 142 144 145 146 147...

output:

273966

result:

ok single line: '273966'

Subtask #5:

score: 33
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #57:

score: 33
Accepted
time: 1170ms
memory: 30340kb

input:

300000
38823036 38824173 38824394 38824857 38825165 38827019 38828368 38830390 38830432 38831149 38831335 38832773 38834848 38835132 38835923 38836047 38836130 38836471 38836610 38837450 38837489 38838781 38838808 38839387 38839469 38839579 38840507 38840616 38841512 38841879 38842412 38842740 38843...

output:

797429213

result:

ok single line: '797429213'

Test #58:

score: 33
Accepted
time: 1348ms
memory: 30156kb

input:

299999
115600 115600 115603 115604 115604 115604 115611 115611 115613 115613 115614 115615 115615 115617 115617 115619 115621 115627 115627 115627 115628 115628 115628 115629 115629 115636 115636 115639 115639 115640 115643 115644 115644 115653 115656 115662 115662 115663 115668 115668 115669 115669...

output:

347406

result:

ok single line: '347406'

Test #59:

score: 33
Accepted
time: 427ms
memory: 25796kb

input:

250000
7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 7797 779...

output:

7796

result:

ok single line: '7796'

Test #60:

score: 33
Accepted
time: 1695ms
memory: 30408kb

input:

300000
113736018 113736492 113736888 113737030 113737961 113738087 113738137 113738581 113738587 113738802 113738889 113739430 113739701 113740428 113740725 113741572 113742100 113742107 113742152 113742337 113742467 113742497 113742614 113742647 113743449 113743483 113743671 113743975 113744234 113...

output:

26197

result:

ok single line: '26197'

Test #61:

score: 33
Accepted
time: 1361ms
memory: 30288kb

input:

299998
180149 180151 180153 180157 180158 180158 180159 180162 180165 180168 180170 180171 180172 180174 180174 180177 180177 180179 180180 180184 180188 180189 180193 180193 180194 180195 180198 180206 180209 180210 180212 180212 180214 180215 180217 180218 180219 180224 180226 180228 180230 180230...

output:

968

result:

ok single line: '968'

Test #62:

score: 33
Accepted
time: 480ms
memory: 30396kb

input:

299999
404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 4...

output:

31

result:

ok single line: '31'

Test #63:

score: 33
Accepted
time: 14ms
memory: 4132kb

input:

10000
474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 474 475 475 475 475 475 475 475 475 475 475 475 475 475 475 475 475 475 475 47...

output:

31

result:

ok single line: '31'

Test #64:

score: 33
Accepted
time: 1063ms
memory: 30392kb

input:

300000
1 1431 3791 7661 8597 11571 11690 13978 20066 20407 21162 22212 25261 26678 27035 33529 35034 43694 46620 53215 53948 56268 60470 66919 69427 71548 73180 73663 74735 76624 77480 85653 86194 90017 97406 97797 98113 98985 100210 110809 111853 114075 115008 116439 118882 120658 123135 128661 129...

output:

999999999

result:

ok single line: '999999999'

Test #65:

score: 33
Accepted
time: 1032ms
memory: 30176kb

input:

300000
634336560 634336724 634336801 634336956 634337699 634344167 634346493 634347415 634349562 634351382 634352496 634352638 634352892 634353355 634354283 634355290 634355325 634356165 634357349 634357491 634357688 634360153 634360360 634361445 634361952 634362017 634364045 634364508 634364611 634...

output:

999999999

result:

ok single line: '999999999'

Test #66:

score: 33
Accepted
time: 1610ms
memory: 30372kb

input:

300000
298353457 298355795 298357350 298357836 298358163 298359717 298360252 298365934 298366293 298367823 298368433 298369077 298369328 298371452 298371737 298372966 298375634 298376210 298377278 298377747 298378343 298379167 298379587 298380143 298380173 298380434 298380737 298381655 298384105 298...

output:

0

result:

ok single line: '0'

Test #67:

score: 33
Accepted
time: 459ms
memory: 30264kb

input:

300000
32474816 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 205639309 2056...

output:

160406522

result:

ok single line: '160406522'

Test #68:

score: 33
Accepted
time: 539ms
memory: 30312kb

input:

300000
2118055 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 7852465 78524...

output:

23213792

result:

ok single line: '23213792'

Test #69:

score: 33
Accepted
time: 337ms
memory: 21344kb

input:

200000
527113395 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570820469 570...

output:

418315442

result:

ok single line: '418315442'

Test #70:

score: 33
Accepted
time: 526ms
memory: 30332kb

input:

299998
537015460 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565564542 565...

output:

342829755

result:

ok single line: '342829755'

Test #71:

score: 33
Accepted
time: 473ms
memory: 30260kb

input:

300000
104768301 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107849554 107...

output:

699092492

result:

ok single line: '699092492'

Test #72:

score: 33
Accepted
time: 549ms
memory: 30240kb

input:

300000
142281008 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152637439 152...

output:

140893721

result:

ok single line: '140893721'

Test #73:

score: 33
Accepted
time: 564ms
memory: 30164kb

input:

300000
10819432 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879647 12879...

output:

22791808

result:

ok single line: '22791808'

Test #74:

score: 33
Accepted
time: 1116ms
memory: 30300kb

input:

300000
1537 3252 4592 5572 7695 8060 8690 8694 10809 10969 11121 12320 13791 13891 15987 16057 17191 17575 17720 19585 20530 20730 20985 21737 24377 26750 26966 29634 30812 32770 34439 36056 37620 39759 42361 47937 48422 50364 50433 50673 51767 52272 52457 54293 56816 56963 57005 57340 58644 60086 6...

output:

166933808

result:

ok single line: '166933808'

Test #75:

score: 33
Accepted
time: 755ms
memory: 21292kb

input:

200000
447 1372 4245 6265 9865 14219 14231 15799 19131 21156 27776 29333 33374 36923 37874 41712 44726 45478 51927 56695 56738 65215 70689 73291 73457 74121 74389 74859 75312 75571 80839 84621 87230 91906 95863 96680 98755 98758 100357 100665 105333 110991 127061 130091 133621 133629 135666 135804 1...

output:

166967442

result:

ok single line: '166967442'

Test #76:

score: 33
Accepted
time: 1154ms
memory: 30316kb

input:

299998
1371 3357 4839 5216 8379 9107 10642 12778 15606 16837 16840 19417 21750 22290 23276 24298 26240 31228 34346 34689 35442 35742 35997 42534 45713 46845 47747 50480 51467 51639 51772 52046 53037 56751 59708 60063 60458 60554 62257 64627 64728 66929 66946 68044 68256 72684 72773 72822 73792 76925...

output:

166937163

result:

ok single line: '166937163'

Test #77:

score: 33
Accepted
time: 481ms
memory: 30396kb

input:

300000
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 173 ...

output:

1

result:

ok single line: '1'

Extra Test:

score: 0
Extra Test Passed