QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#155025#6521. Swapping OperationInsert_Username_HereAC ✓184ms41512kbC++202.4kb2023-09-01 06:29:122023-09-01 06:29:13

Judging History

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

  • [2023-09-01 06:29:13]
  • 评测
  • 测评结果:AC
  • 用时:184ms
  • 内存:41512kb
  • [2023-09-01 06:29:12]
  • 提交

answer

#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
// Cope Counter = at least 127

ll n;
ll arr[100001], kms[19][100001];
map<ll, vector<ll>> bk;

ll wxzs(ll l, ll r) {
  for(ll i = 17; i >= 0; i--) {
    if(r - l + 1 >= (1 << i)) return kms[i][l] & kms[i][r - (1 << i) + 1];
  }
  return (1ll << 31) - 1;
}
ll qry(ll type, ll val, ll i) {
  if(bk[val].empty()) {
    vector<ll> cancer(n);
    if(type) {
      cancer[0] = arr[0] & val;
      for(ll j = 1; j < n; j++) cancer[j] = max(cancer[j - 1], arr[j] & val);
    } else {
      cancer[n - 1] = arr[n - 1] & val;
      for(ll j = n - 2; j >= 0; j--) cancer[j] = max(cancer[j + 1], arr[j] & val);
    }
    bk[val] = cancer;
  }
  return bk[val][i];
}

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
  ll t;
  cin >> t;
  while(t--) {
    cin >> n;
    for(ll i = 0; i < n; i++) {
      cin >> arr[i];
      kms[0][i] = arr[i];
    }
    for(ll i = 0; i < 18; i++) {
      for(ll j = 0; j + (1 << i) < n; j++) {
        kms[i + 1][j] = kms[i][j] & kms[i][j + (1 << i)];
      }
    }
    vector<ll> sped[2];
    sped[0].push_back(0), sped[1].push_back(n - 1);
    ll pre = arr[0], suf = arr[n - 1], ans = 0;
    for(ll i = 1; i < n; i++) {
      ans = max(ans, wxzs(0, i - 1) + wxzs(i, n - 1));
      if((pre & arr[i]) != pre) {
        pre &= arr[i];
        sped[0].push_back(i);
      }
      if((suf & arr[n - i - 1]) != suf) {
        suf &= arr[n - i - 1];
        sped[1].push_back(n - i - 1);
      }
    }
    for(ll k = 1; k < n; k++) {
      for(ll i : sped[0]) {
        if(i >= k) break;
        for(ll j : sped[1]) {
          if(j < k) break;
          ans = max(ans, (wxzs(0, i - 1) & arr[j] & wxzs(i + 1, k - 1)) + (wxzs(k, j - 1) & arr[i] & wxzs(j + 1, n - 1)));
        }
      }
    }
    for(ll thing = 0; thing < 2; thing++) {
      bk.clear();
      for(ll k = 1; k < n; k++) {
        for(ll i : sped[thing]) {
          if((!thing && i >= k) || (thing && i < k)) break;
          if(thing) ans = max(ans, qry(thing, wxzs(k, i - 1) & wxzs(i + 1, n - 1), k) + (wxzs(0, k - 1) & arr[i]));
          else ans = max(ans, qry(thing, wxzs(0, i - 1) & wxzs(i + 1, k - 1), k) + (wxzs(k, n - 1) & arr[i]));
        }
      }
    }
    cout << ans << "\n";
  }
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

7
3
3

result:

ok 3 number(s): "7 3 3"

Test #2:

score: 0
Accepted
time: 123ms
memory: 9708kb

input:

1000
100
803046221 177233942 164782937 53823867 383853667 250036100 888743479 576687945 737272231 801579441 647643785 393059353 401516062 663466861 308544510 825328494 162739603 501761995 570908380 655227403 444493122 844535039 208303132 493226172 421479971 634680694 396627047 787471115 335787136 16...

output:

999397418
953601453
996676598
986700621
959469962
997532753
991939977
998064178
992514137
989100873
997784581
990111329
976588292
999515942
997721120
998122389
999751601
995753373
995915998
940455262
994686107
986433302
981799808
992366273
991914073
978772754
993464658
980800625
985148851
993204707
...

result:

ok 1000 numbers

Test #3:

score: 0
Accepted
time: 117ms
memory: 7756kb

input:

1000
100
868540859 536350094 243301178 399864672 63800499 60509883 662790489 933274863 712366832 250096549 353585859 849489613 287472674 378377984 318230727 227886897 734961837 146655379 415711604 114613730 147672354 398490255 401593832 198312435 896274101 473745940 345810320 745314936 192335687 317...

output:

993176411
990935453
989361310
998797029
997071496
997847030
993812394
978774674
986546369
979008739
973079854
992485632
996627688
991296275
985058500
982113648
986788726
989529759
991217219
976255336
999106271
983222240
998596661
989428133
995764679
968130163
996135026
975316802
984010492
999825964
...

result:

ok 1000 numbers

Test #4:

score: 0
Accepted
time: 132ms
memory: 14012kb

input:

100
1000
536870911 536870911 536870911 53060959 536870911 824976769 536870911 536870911 536870911 536870911 536870911 292812131 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 503316479 536870911 536870911 53...

output:

992267223
998203121
943491181
998903380
991177464
994506493
991568130
996548810
990887537
977900609
996604614
995782790
967198982
986736211
990460937
992025719
999311398
990411560
998302321
992464450
990685689
993256052
994112039
949448278
983078732
996318822
993360844
997651891
993329997
993539076
...

result:

ok 100 numbers

Test #5:

score: 0
Accepted
time: 128ms
memory: 9896kb

input:

100
1000
536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 5...

output:

989528581
993996713
987322111
997982929
998411959
998047555
999898583
983949131
997770426
986856306
986799747
998795930
999640185
984460916
996247390
997607144
996714502
959513743
999472672
988163119
992362297
986480589
999789548
987204597
998918966
999966811
995959839
957028075
977378449
995330581
...

result:

ok 100 numbers

Test #6:

score: 0
Accepted
time: 134ms
memory: 11984kb

input:

100
1000
536870911 536870911 536870911 536870911 536870911 873747431 536870911 536870911 536870911 536870911 336783235 536870911 536870911 536870911 312523694 536870911 4017189 536870911 536870911 536870911 536870911 290368219 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536...

output:

992519359
989582892
989345356
998114450
993532797
989582728
993903109
995936284
996498642
992674823
994002132
994542615
983215409
988921071
999812015
981484433
968086906
998292038
978463424
999965405
980176369
998066264
995426213
972214685
948402982
972799570
997541905
998460289
999426084
995312621
...

result:

ok 100 numbers

Test #7:

score: 0
Accepted
time: 134ms
memory: 10188kb

input:

100
1000
536870911 536870911 536870911 536870911 532704110 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 106395503 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 5...

output:

990153664
981943279
993427066
998331476
975536167
998348971
982632668
951082488
978270675
997843098
996280859
988633268
996123264
997099067
997282090
990623734
990869306
991019882
997017015
998700326
974472542
984414496
992295335
995838763
990083833
963265158
998577560
954058208
991843879
998783291
...

result:

ok 100 numbers

Test #8:

score: 0
Accepted
time: 92ms
memory: 16064kb

input:

10
10000
536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 5...

output:

990029081
996941040
996327033
997094193
990980188
986535974
995007098
992269180
986003383
990736573

result:

ok 10 numbers

Test #9:

score: 0
Accepted
time: 118ms
memory: 19968kb

input:

10
10000
536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 5...

output:

998160970
962252371
994002209
991351157
989772171
995168012
992749639
979618052
993648300
994703533

result:

ok 10 numbers

Test #10:

score: 0
Accepted
time: 115ms
memory: 17996kb

input:

10
10000
536870911 536870911 536870911 536870911 536870911 16495861 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 53...

output:

985813020
994294933
997857971
993640204
986032808
998285161
983501855
971946900
956658469
999420409

result:

ok 10 numbers

Test #11:

score: 0
Accepted
time: 95ms
memory: 17536kb

input:

10
10000
536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 313408423 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 313570023 536870911 536870911 536870911 5...

output:

982812296
997742114
981766884
999744972
997761413
998863157
985723058
993661054
978461035
988009489

result:

ok 10 numbers

Test #12:

score: 0
Accepted
time: 71ms
memory: 33216kb

input:

1
100000
536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 5...

output:

972405752

result:

ok 1 number(s): "972405752"

Test #13:

score: 0
Accepted
time: 93ms
memory: 35384kb

input:

1
100000
536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 5...

output:

998689648

result:

ok 1 number(s): "998689648"

Test #14:

score: 0
Accepted
time: 60ms
memory: 30480kb

input:

1
100000
536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 5...

output:

994388419

result:

ok 1 number(s): "994388419"

Test #15:

score: 0
Accepted
time: 63ms
memory: 35220kb

input:

1
100000
536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 5...

output:

989540923

result:

ok 1 number(s): "989540923"

Test #16:

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

input:

100
1000
65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 837325606 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 32767 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 126115569 1...

output:

982308028
996564253
996609583
997022165
999374550
985361560
999478520
993722720
991250154
979352632
986662229
941977900
994874484
987631482
986434267
992081760
983067730
981143075
960913139
968402815
977588561
994831317
974612625
988674180
999955804
997471683
999190084
998157218
989508864
990923047
...

result:

ok 100 numbers

Test #17:

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

input:

100
1000
616268620 1048575 1048575 1048575 452541743 1048575 1048575 1048575 1048575 1048575 1048575 606479664 1048575 1048575 1048575 1048575 1048575 1048575 1048575 1048575 1048575 1048575 1048575 1048575 363441026 1048575 1048575 1048575 1048575 1048575 1048575 1048575 1048063 1048575 1048575 104...

output:

996150731
984809627
995669944
982030168
991635773
993567985
997822209
991209301
981201290
998182500
997161166
981475211
992222302
996125404
991731823
996458082
992441428
986905918
980110015
994853843
994902592
987967626
997935529
993287385
978588380
994185418
992141092
998867415
993128068
998901163
...

result:

ok 100 numbers

Test #18:

score: 0
Accepted
time: 101ms
memory: 11872kb

input:

100
1000
65535 618316639 65535 65535 993627304 380378305 65535 65535 65535 945385481 65535 65535 65535 65535 65535 65535 79411578 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 914329319 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65527 65535 65535 65535 65535 65535 6553...

output:

993627304
997223787
995172986
967820232
922402818
997535890
993611366
992655911
990088233
974096338
991520197
994247557
986080004
988680068
999969094
989722792
993034847
997733224
981663826
999346544
988286385
985827812
998217951
996190322
997875057
990266756
961958261
999840457
997202565
965336151
...

result:

ok 100 numbers

Test #19:

score: 0
Accepted
time: 105ms
memory: 12020kb

input:

100
1000
65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 965746870 65535 65535 26067041 65535 65535 65535 65535 65535 65535 65407 815280236 65535 65535 65535 65535 65535 65535 141975591 31573753 65535 65535 65535 65535 65535 65535 65535 65535 65535 714044884 65535 65535 65535 65535 65535...

output:

994767992
999418764
999595232
989253454
995703749
995109821
995572054
998158226
998824617
993115590
995195933
998165626
988778437
999809543
999050273
989769941
988127888
997869761
973559942
976992249
983966156
994286226
985631965
999385566
999168590
991878403
990876708
997710130
998254097
975887194
...

result:

ok 100 numbers

Test #20:

score: 0
Accepted
time: 79ms
memory: 15316kb

input:

10
10000
65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 655...

output:

979181468
995314897
999891673
994759732
995272120
991865668
990726455
993478676
992528987
987220465

result:

ok 10 numbers

Test #21:

score: 0
Accepted
time: 81ms
memory: 17216kb

input:

10
10000
65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 655...

output:

959263243
991996367
995991242
997110748
948361300
977587814
974675025
993689915
983580122
999288163

result:

ok 10 numbers

Test #22:

score: 0
Accepted
time: 91ms
memory: 17556kb

input:

10
10000
33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 335...

output:

998080400
988696279
994030605
985117297
977015987
993716359
994170126
992382439
997862873
992083867

result:

ok 10 numbers

Test #23:

score: 0
Accepted
time: 104ms
memory: 17688kb

input:

10
10000
268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 2...

output:

993892148
982630093
970910815
997072305
976510027
997040055
985100681
996417543
995614901
995181841

result:

ok 10 numbers

Test #24:

score: 0
Accepted
time: 52ms
memory: 31292kb

input:

1
100000
268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 2...

output:

989497980

result:

ok 1 number(s): "989497980"

Test #25:

score: 0
Accepted
time: 104ms
memory: 35720kb

input:

1
100000
268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 2...

output:

985741038

result:

ok 1 number(s): "985741038"

Test #26:

score: 0
Accepted
time: 85ms
memory: 34816kb

input:

1
100000
268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 2...

output:

999945210

result:

ok 1 number(s): "999945210"

Test #27:

score: 0
Accepted
time: 78ms
memory: 41512kb

input:

1
100000
268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 268435455 2...

output:

967682724

result:

ok 1 number(s): "967682724"

Test #28:

score: 0
Accepted
time: 184ms
memory: 7944kb

input:

2000
50
368834445 502136717 402515949 99477359 402253581 368701357 368705535 401473453 268433183 132906943 401340269 502263599 236919675 367785869 100394767 367914765 535691229 234743695 367650621 401205103 367912781 99477439 401604399 502917103 502265805 133955453 134213439 267787059 240623442 2469...

output:

535691997
536779215
536788603
536800399
536870509
537921287
533715579
539191097
536862345
534249350
536609029
537003864
536608483
542065355
536858821
536861196
536458027
535600908
536330977
534768913
536599904
536867089
532365675
532676195
536862761
536871120
536870413
603994438
536764403
535801172
...

result:

ok 2000 numbers

Test #29:

score: 0
Accepted
time: 176ms
memory: 7796kb

input:

1000
100
451411959 245354934 187160566 179698623 443408375 530044406 168808886 514192311 446159358 266861502 461754806 445511606 168812542 527422455 192273335 191755766 246800310 175102966 172479991 189789623 529002999 253615615 235394046 260437430 510523839 442367479 523227582 183488951 256759295 1...

output:

536805033
528351395
536786329
536574720
536870257
536247452
536871110
536870633
536321365
536828411
536869357
536798876
536871119
536870881
545258170
536871200
536605236
536297682
536870975
536870746
536864478
536871223
536866140
536862655
536625848
536863055
536867016
531101670
536805981
536871339
...

result:

ok 1000 numbers

Test #30:

score: 0
Accepted
time: 158ms
memory: 12136kb

input:

500
200
536829271 266291657 266173219 266186525 266299729 266161947 536840700 268426213 534595858 534756189 268426551 266145187 534597608 536858075 268292067 266307891 534597062 266181411 536686582 266166263 266174402 534712202 536828359 266333523 534748053 536681893 268430226 536836402 536816926 26...

output:

536871031
536868039
536737074
536852005
536871868
536870487
536871462
536346743
536871171
536870310
536801220
536739481
536870371
536740627
535790110
536721988
536707382
536603910
534622352
536832175
536870568
536870849
536871098
536868885
536854633
536850904
536328262
536592284
536494021
536831862
...

result:

ok 500 numbers

Test #31:

score: 0
Accepted
time: 150ms
memory: 13996kb

input:

333
300
368343389 268235593 368493819 532052185 532571741 230449369 502645211 397797869 95899629 129297887 264100811 100583641 230483803 129780329 532081133 499020397 268398795 264107885 503311851 398321871 133558859 264005067 503177565 402081273 263551709 263585355 129286861 402475769 100586617 503...

output:

536758748
536838312
536866044
536830148
536869928
536862579
534754447
536804212
536871381
536864583
536871233
536865478
536869018
536870682
536871276
536866640
536860297
536869664
536871674
536871046
536869377
536870940
536654581
536853997
536583867
536871542
536506158
531349823
536837796
536805375
...

result:

ok 333 numbers

Test #32:

score: 0
Accepted
time: 140ms
memory: 9936kb

input:

200
500
401010685 233553663 460566493 125222909 402108415 493547261 58191583 65454077 201326333 259243773 326823933 402583295 359137277 24641279 501723135 100400861 400998109 200785917 91930335 301924093 494841821 333967327 233549823 266776575 91402239 90959837 427273949 402112509 124973023 33271805...

output:

536868504
536871413
536871379
536871580
536871708
536870667
536871828
536883423
536868817
536820006
536868354
536799171
536870229
536870942
536870851
536870803
536871412
536788417
536859035
536273246
536866629
536870393
536833609
536868991
536870483
536850177
536871101
536870123
536832361
536862300
...

result:

ok 200 numbers

Test #33:

score: 0
Accepted
time: 149ms
memory: 11936kb

input:

100
1000
525287141 527228903 485465839 482975461 485441533 257490943 233537511 517414637 535338997 474111999 491773935 501554919 524476135 205938423 474808055 475651815 476020471 216014589 511606781 233717479 257736679 249536495 525672173 482893823 247832575 492846821 484302565 259932151 500096759 5...

output:

536871444
536871589
536862577
536865506
536870914
536870926
536868164
536870983
536862641
536868427
536871617
536871093
536870925
536866739
536868589
536868799
536871693
536846321
536862835
536871533
536870162
536871259
536870861
536871214
536870377
536870767
536871527
536870937
536866521
536863012
...

result:

ok 100 numbers

Test #34:

score: 0
Accepted
time: 139ms
memory: 16816kb

input:

20
5000
263944879 196803183 188694078 465247167 468909886 528366462 187906862 528145343 196239358 465510143 528375743 263700335 456285119 456351551 196549294 456269807 263346926 268049150 264199086 268131054 188627567 188186367 259219070 188644926 468934463 259170111 528162367 197122798 469154543 45...

output:

536871389
536870653
536871303
536868922
536870905
536866430
536871219
536871097
536870974
536871520
536870847
536870927
536871182
536871038
536866623
536870529
671622779
536870975
536870912
536871287

result:

ok 20 numbers

Test #35:

score: 0
Accepted
time: 124ms
memory: 16152kb

input:

10
10000
494653375 117394142 368836603 426724250 74404859 293305242 16503710 234872735 82532059 217015995 493606591 377446303 49249178 108775099 267347707 309019294 468451227 369085339 141551322 133168858 242993114 209668767 402344894 267082491 141546138 493876923 300938202 251625183 58677242 587069...

output:

536871049
536870906
536870809
536871267
536870848
536871159
536871026
536870933
536870907
536870935

result:

ok 10 numbers

Test #36:

score: 0
Accepted
time: 124ms
memory: 38376kb

input:

1
100000
200987903 331019519 66907323 66825979 469687743 196717995 330948091 402228911 469755119 201186555 130014383 330934267 398190315 62703359 402189807 402246831 335329007 335449595 201254575 133740527 196775611 133889967 263831231 268275131 66761919 263892395 536457135 469337775 469403563 13400...

output:

536870953

result:

ok 1 number(s): "536870953"

Test #37:

score: 0
Accepted
time: 26ms
memory: 9796kb

input:

10000
9
6 1 4 3 0 6 4 0 1
8
4 5 7 0 3 3 5 7
10
0 2 5 2 6 1 3 7 3 7
6
6 0 0 6 5 2
4
6 3 4 1
2
7 3
9
4 7 1 0 6 2 2 1 2
2
2 1
6
3 4 6 4 7 4
5
5 0 7 5 0
7
6 1 7 5 7 4 2
10
3 1 5 7 1 7 0 7 2 0
9
3 3 4 6 4 6 4 5 7
3
7 2 3
10
0 1 6 0 5 1 1 4 2 6
4
6 4 7 2
4
7 1 6 7
5
2 4 5 4 7
8
0 0 6 4 1 6 5 3
4
6 1 7 1
2...

output:

6
7
7
6
6
10
7
3
7
7
7
7
7
9
6
7
7
7
6
7
3
5
7
6
4
7
7
7
7
4
7
6
4
10
6
7
7
7
4
6
7
7
8
6
5
7
7
6
6
7
6
7
7
6
5
8
7
8
7
7
7
7
7
5
10
8
7
8
10
7
6
7
7
6
6
6
7
9
6
6
4
7
0
7
3
7
7
3
9
4
7
6
9
6
7
4
7
7
6
7
5
6
3
6
5
9
6
7
7
5
6
7
7
7
9
11
6
7
3
7
6
7
7
11
7
6
7
7
7
6
6
6
7
7
6
7
6
7
6
6
6
3
7
6
6
9
7
...

result:

ok 10000 numbers

Test #38:

score: 0
Accepted
time: 57ms
memory: 7912kb

input:

10000
10
202258141 201995997 201995997 203044573 202012381 201996029 204093149 39778060 202028765 48166156
10
192427872 192427872 176266971 192429924 192575328 176397947 197238491 180731483 176397915 176283227
10
221176062 221044988 221029628 221028604 221028604 221028604 229417212 221029628 2133724...

output:

241773545
368694715
434401029
449948767
495200638
265690802
476521322
319676450
359375798
284399002
415349443
443069498
446966934
242780419
228349172
266882346
270156436
283645257
430195992
193955252
160789138
501428552
443393409
324556029
482315927
372940111
213879214
185821865
302221982
165100619
...

result:

ok 10000 numbers

Test #39:

score: 0
Accepted
time: 43ms
memory: 9800kb

input:

1000
100
211789168 144680304 32521511 161457520 211789176 161457520 144680816 144680304 146777584 161457520 146777458 144680304 211789168 211789170 144680304 144680304 163554672 178251120 146777456 211789172 180331888 144696692 144680304 146793840 144680304 144680304 144680304 144680304 144680432 14...

output:

221252240
308389449
363012332
250238784
266643746
325141193
294764905
252456673
404270424
277491036
287132434
280430978
307557634
330715233
208558396
404047592
279778914
237016626
313613220
166405689
408537340
408205730
158771564
421685448
341178674
261333858
314529813
259205426
365021312
358655162
...

result:

ok 1000 numbers

Test #40:

score: 0
Accepted
time: 36ms
memory: 11988kb

input:

100
1000
57683133 57683133 57683645 57814205 57683133 57683133 57683133 57683133 57699517 58469565 57683133 66071741 57765055 57683133 57945279 57699519 57846973 57683135 57683133 57683133 191900861 66071741 57687229 57683133 57683133 57683133 57683133 57687229 57683133 58010813 57683133 57683135 57...

output:

310416741
293783962
264553814
243688748
279564840
297801736
216677162
239756425
245660081
275290290
337766164
411205928
413993296
294997220
282155077
299149700
240305257
261237520
308844960
388982924
284459451
367794958
411155054
404901458
391422420
325785331
253577652
288715060
283718298
321139984
...

result:

ok 100 numbers

Test #41:

score: 0
Accepted
time: 30ms
memory: 14500kb

input:

10
10000
64080986 198298718 64080987 64080986 64080986 198298842 64080986 64080986 64474202 64080986 198298714 64080986 64080986 64089178 64080986 198298746 64080990 64080986 64343130 64081754 64081498 64080986 64080990 64081018 64080986 64081018 64080986 64080986 64080986 66178138 64093274 64605275...

output:

324506722
449438853
294464680
265818692
408754820
274048642
285333268
281171305
405621176
278221338

result:

ok 10 numbers

Test #42:

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

input:

1
100000
33290757 8124941 8387077 8124933 8387077 8124933 8388103 142342661 8124933 75233797 8124933 8124941 8124933 8124933 8124933 8124935 8124933 16513541 8124933 8124933 75233797 8124933 8124933 8124933 8124933 8125989 8125189 8124957 8124933 24903173 8124965 8124933 8124933 41679429 8124933 812...

output:

272201984

result:

ok 1 number(s): "272201984"

Test #43:

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

input:

1
100000
216834778 216851160 216834808 216834776 216836824 216834777 216834776 216835032 216900312 216834778 216851160 216834776 216834778 216834776 216900312 216834776 216836824 216834778 216834776 216900312 216900312 216834776 216965848 216835800 216834776 216834808 216834776 216834776 216834776 2...

output:

449948767

result:

ok 1 number(s): "449948767"