QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#116132#2631. Sandcastle 2lmeowdn100 ✓1421ms143348kbC++143.4kb2023-06-28 10:27:402023-06-28 10:27:43

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-28 10:27:43]
  • 评测
  • 测评结果:100
  • 用时:1421ms
  • 内存:143348kb
  • [2023-06-28 10:27:40]
  • 提交

answer

#include<bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 i128;
template<typename T,typename U>
T ceil(T x, U y) {return (x>0?(x+y-1)/y:x/y);}
template<typename T,typename U>
T floor(T x, U y) {return (x>0?x/y:(x-y+1)/y);}
template<class T,class S>
bool chmax(T &a,const S b) {return (a<b?a=b,1:0);}
template<class T,class S>
bool chmin(T &a,const S b) {return (a>b?a=b,1:0);}
int popcnt(int x) {return __builtin_popcount(x);}
int popcnt(ll x) {return __builtin_popcountll(x);}
int topbit(int x) {return (x==0?-1:31-__builtin_clz(x));}
int topbit(ll x) {return (x==0?-1:63-__builtin_clzll(x));}
int lowbit(int x) {return (x==0?-1:__builtin_ctz(x));}
int lowbit(ll x) {return (x==0?-1:__builtin_ctzll(x));}

#define int long long
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
typedef pair<int,int> pii; 
typedef vector<int> vi;
typedef vector<pii> vp;
typedef tuple<int,int,int> tiii;
int read() {
  int x=0,w=1; char c=getchar(); 
  while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
  while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();}
  return x*w;
}

const int N=5e4+5;
int n,m,b[N][15],v[N],s[N],ans,swp;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
vi a[N],vst[N];
vector<vi> f[N],t[N];
vp tmp;

int calc(int l,int r,int u,int d,int x,int y) {
  rep(i,u,d) rep(j,l,r) {
    tmp.clear();
    rep(k,0,3) {
      int nx=i+dx[k], ny=j+dy[k];
      if(u<=nx&&nx<=d&&l<=ny&&ny<=r)
        tmp.eb(a[nx][ny],k);
    }
    if(tmp.size()) {
      sort(tmp.begin(),tmp.end());
      for(auto [w,k]:tmp) if(w>a[i][j]) {
        int nx=i+dx[k], ny=j+dy[k];
        vst[nx][ny]++; break;
      }
    }
  }
  int res=!vst[x][y];
  rep(i,u,d) rep(j,l,r) vst[i][j]=0;
  return res;
}

signed main() {
  n=read(), m=read();
  if(n>m) swp=1, swap(n,m);
  rep(i,0,n+1) a[i].resize(m+2), vst[i].resize(m+2);
  rep(i,0,n+1) {
    f[i].resize(m+2), t[i].resize(m+2);
    rep(j,0,m+1) f[i][j].resize(85), t[i][j].resize(15);
  }
  if(!swp) rep(i,1,n) rep(j,1,m) a[i][j]=read();
  else rep(j,1,m) rep(i,1,n) a[i][j]=read();
  rep(l,0,2) rep(r,0,2) rep(u,0,2) rep(d,0,2) {
    int p=((d*3+u)*3+r)*3+l;
    rep(i,1,n) rep(j,1,m) {
      int lb=max(1ll,j-l), rb=min(m,j+r);
      int ub=max(1ll,i-u), db=min(n,i+d);
      f[i][j][p]=calc(lb,rb,ub,db,i,j);
    }
  }
  rep(i,1,n) rep(j,1,m) rep(k,0,8) {
    t[i][j][k]=t[i-1][j][k]+f[i][j][72+k];
  }
  rep(u,1,n) rep(d,u,n) {
    rep(j,1,m) rep(k,0,8) b[j][k]=0;
    if(d-u+1<=3) {
      rep(i,u,d) rep(j,1,m) {
        int pu=i-u, pd=d-i, p=(pd*3+pu)*9;
        rep(k,0,8) b[j][k]+=f[i][j][p+k];
      }
    } else {
      rep(j,1,m) rep(k,0,8) {
        b[j][k]=f[u][j][54+k]+f[u+1][j][63+k]
               +f[d-1][j][45+k]+f[d][j][18+k]
               +t[d-2][j][k]-t[u+1][j][k];
      }
    }
    rep(j,1,m) s[j]=s[j-1]+b[j][8];
    rep(j,1,m) {
      int res=(b[j][0]==1);
      if(j>1) res+=(b[j-1][3]+b[j][1]==1);
      if(j>2) res+=(b[j-2][6]+b[j-1][4]+b[j][2]==1);
      if(j>3) {
        int k=j-3;
        int y=s[k+1]-b[k][6]-b[k+1][7]+1; if(y>=0) v[y]++;
        int x=b[j-1][5]+b[j][2]+s[j-2]; res+=v[x];
      }
      ans+=res;
    }
    rep(j,1,m-1) {
      int y=s[j+1]-b[j][6]-b[j+1][7]+1; if(y>=0) v[y]=0;
    }
  }
  printf("%lld\n",ans);
  return 0;
}

詳細信息

Subtask #1:

score: 9
Accepted

Test #1:

score: 9
Accepted
time: 2ms
memory: 10640kb

input:

1 1
10000000

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 300ms
memory: 143168kb

input:

1 50000
9999748 9999480 9999470 9999383 9998929 9998516 9998342 9998117 9997628 9997456 9997207 9997170 9997070 9996895 9996750 9996729 9996648 9996629 9996479 9996325 9996260 9996031 9995931 9995765 9995690 9995625 9994849 9994718 9994582 9994576 9994548 9994497 9994475 9994368 9994157 9994017 9993...

output:

1250025000

result:

ok single line: '1250025000'

Test #3:

score: 0
Accepted
time: 372ms
memory: 141052kb

input:

1 49125
7655881 1348165 5649486 1974705 5118597 4706888 7128454 4596319 6246987 1483167 8042875 4763942 7076207 1486435 8861615 3184519 7488281 2039517 6853976 2962323 7373534 737693 9053851 4825886 7489618 4974344 7539086 4922722 5192977 3345144 8256813 3401333 7044855 3072068 7667403 2516664 63360...

output:

98249

result:

ok single line: '98249'

Test #4:

score: 0
Accepted
time: 293ms
memory: 143124kb

input:

1 49987
9999898 9999591 9999531 9999338 9999290 9998573 9998385 9998335 9998202 9997907 9997778 9997733 9997251 9996722 9996566 9996516 9996435 9995742 9995280 9994969 9994753 9994704 9994300 9993935 9993359 9993071 9993054 9992802 9992741 9992656 9992469 9992459 9991817 9991534 9991103 9991069 9991...

output:

981292718

result:

ok single line: '981292718'

Test #5:

score: 0
Accepted
time: 308ms
memory: 143340kb

input:

1 50000
1969 16157 19395 35532 86516 116178 126610 139220 163136 213438 233389 261267 278233 294964 350166 381183 382447 385583 418133 420175 420682 421085 424683 427848 439059 521638 548535 558881 564717 580203 614879 652777 676196 705460 706403 711796 712578 726181 768358 792875 793418 806297 8080...

output:

53344804

result:

ok single line: '53344804'

Test #6:

score: 0
Accepted
time: 321ms
memory: 143348kb

input:

1 49994
3252141 1522783 1421112 3771042 508375 3011515 3605530 3751518 6431057 4213433 5252234 526166 8425636 741591 6327718 4515510 961034 769418 4000102 7492192 8608572 8154381 7492317 9054761 9373601 2602306 2992805 9917298 792997 7622951 1646118 1824039 4075389 7389655 9198385 5062366 9178283 48...

output:

121686

result:

ok single line: '121686'

Subtask #2:

score: 10
Accepted

Test #7:

score: 10
Accepted
time: 4ms
memory: 11044kb

input:

19 5
9647057 433842 4968948 1455077 4976834
9728002 1833064 9295371 842976 6855341
3714078 6987682 6514764 1302018 3471358
9723507 4592053 784135 8452727 3015494
2510077 9917250 1912443 6907654 2189965
8984668 9774352 2704810 3877859 9875047
1764828 7750093 4447069 7339780 6916838
9016382 5114182 75...

output:

342

result:

ok single line: '342'

Test #8:

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

input:

9 11
9151059 161717 5912867 1838276 9968649 2079443 9178660 5522216 7079489 6524297 2484960
7930511 2564595 149661 9492057 19351 5978602 3326654 1644580 1527440 3214919 290776
9675670 5592865 7459706 4161256 4206965 3157007 7746570 5714171 8923405 4638972 8017009
3334200 5257077 7793454 595190 39283...

output:

352

result:

ok single line: '352'

Test #9:

score: 0
Accepted
time: 2ms
memory: 9372kb

input:

10 10
60802 138944 235271 542854 650492 698613 711601 788939 910209 948906
2311500 2218750 2174612 2170130 1807194 1780543 1182492 1039697 1007447 986230
2324251 2359199 2393597 2469194 2535525 2561624 2652434 2744560 3002897 3208614
4069837 3910592 3858339 3836985 3644589 3584262 3492391 3325596 32...

output:

3025

result:

ok single line: '3025'

Test #10:

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

input:

10 10
1156347 855773 767521 730105 702776 683661 386026 115907 58257 53393
2409343 2106217 2054429 2008677 1989892 1841586 1820913 1804664 1386423 1248173
3218658 3097114 3070674 2870288 2763632 2750768 2733549 2714975 2612152 2470082
3778152 3761620 3616479 3592177 3549923 3430997 3424943 3396253 3...

output:

1000

result:

ok single line: '1000'

Test #11:

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

input:

10 10
57530 3395039 3376773 3301689 3015304 2965187 2943535 2901034 2830699 2623258
156284 3612018 6493239 6483446 6479923 6161774 6124652 6014642 5930032 2595677
164044 3833243 6587688 8663321 8663101 8554117 8471857 8405489 5925980 2580140
214332 3844116 6671852 8843147 8764905 8694473 8664276 831...

output:

766

result:

ok single line: '766'

Test #12:

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

input:

12 8
100058 100059 100060 100063 100064 100067 100068 100069
100057 100056 100061 100062 100065 100066 100071 100070
100054 100055 100050 100049 100078 100077 100072 100073
100053 100052 100051 100048 100079 100076 100075 100074
100042 100043 100044 100047 100080 100083 100084 100085
100041 100040 1...

output:

1207

result:

ok single line: '1207'

Subtask #3:

score: 5
Accepted

Dependency #2:

100%
Accepted

Test #13:

score: 5
Accepted
time: 3ms
memory: 14328kb

input:

1500 1
4352
5889
8496
22570
23190
27994
31887
44826
49765
71412
92911
94398
100085
111334
122841
122936
124437
124661
127451
131327
134793
135081
136871
158584
167552
167965
176948
179720
185839
190869
202652
203281
213274
217023
222950
223087
226518
234143
251153
256173
260131
261101
268286
268497
...

output:

1125750

result:

ok single line: '1125750'

Test #14:

score: 0
Accepted
time: 6ms
memory: 15008kb

input:

1500 1
8257499
3214641
2569241
4685201
2322982
1668543
9626597
2591513
4874544
5206173
8449546
1418918
4108333
2632394
5247833
1265936
8726317
7558310
7791069
28481
7786804
7446859
7870558
512266
290650
878238
7455693
911087
3870384
2881289
4259051
4897786
2701479
789322
2092613
5102393
8097454
8131...

output:

3643

result:

ok single line: '3643'

Test #15:

score: 0
Accepted
time: 34ms
memory: 12316kb

input:

35 42
1395689 9524384 8554863 9800641 9922501 2775741 1354983 992654 8496640 522014 9376302 8704619 9136837 5361324 3438535 7804605 5813744 4510250 3827356 2655792 6580797 3876926 4836648 5736612 3404153 3221980 9699234 6874805 5427899 5655020 1245741 1572438 3082519 9039907 3030770 4725214 9917877 ...

output:

6029

result:

ok single line: '6029'

Test #16:

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

input:

50 30
9999938 9344938 9332082 8569772 8562750 7936906 7933310 7347043 7338784 6593278 6589410 5952260 5950131 5325275 5320419 4556170 4554594 3900630 3899304 3230798 3217866 2632561 2628926 2016697 2009149 1395710 1391172 580013 579526 2397
9991249 9352611 9326055 8579417 8555247 7941529 7929466 734...

output:

592875

result:

ok single line: '592875'

Test #17:

score: 0
Accepted
time: 9ms
memory: 11892kb

input:

2 750
20363 21544 46017 49902 64555 64790 79190 80405 87732 107722 126311 128320 161804 168788 171156 173686 192926 204500 216291 217641 227552 232597 274609 287129 326056 332234 362042 364374 384359 392185 409801 417219 461586 475461 503572 509308 538502 546011 559391 570184 581675 590666 611055 61...

output:

844875

result:

ok single line: '844875'

Test #18:

score: 0
Accepted
time: 11ms
memory: 12484kb

input:

750 2
9996907 101
9996430 2322
9994946 9875
9980576 14920
9978391 21896
9974097 27753
9973704 29582
9972193 34002
9965178 34727
9963917 39770
9961894 45577
9956810 59943
9950212 63306
9943246 71165
9940737 81227
9937410 83444
9933251 87776
9917080 90132
9910939 101193
9907682 101494
9906675 103570
9...

output:

844875

result:

ok single line: '844875'

Test #19:

score: 0
Accepted
time: 18ms
memory: 12212kb

input:

38 38
773268 768105 751434 747339 736916 726680 724139 709432 707391 694443 678704 659314 658428 625189 615533 599325 599020 598668 588445 576284 569828 565802 562693 559657 558830 541348 541178 540687 536925 534602 533875 530466 529929 527627 527617 519845 518026 514792
774072 1783280 1781632 17693...

output:

37804

result:

ok single line: '37804'

Test #20:

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

input:

32 32
100682 100683 100684 100687 100688 100689 100702 100703 100704 100707 100708 100709 100762 100763 100764 100767 100768 100769 100782 100783 100784 100787 100788 100789 101002 101003 101004 101007 101008 101009 101022 101023
100681 100680 100685 100686 100691 100690 100701 100700 100705 100706 ...

output:

21534

result:

ok single line: '21534'

Test #21:

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

input:

50 30
100000 100001 100002 100003 100004 100010 100019 100018 100017 100016 100020 100023 100024 100025 100026 100030 100033 100034 100039 100038 100040 100043 100044 100047 100048 100059 100050 100051 100052 100053
100009 100008 100007 100006 100005 100011 100012 100013 100014 100015 100021 100022 ...

output:

25989

result:

ok single line: '25989'

Test #22:

score: 0
Accepted
time: 34ms
memory: 11628kb

input:

50 30
100062 100098 100003 100132 100185 100319 100146 100386 100229 101441 101019 100230 100111 100069 100285 100145 100561 100413 100097 100083 101493 101393 100490 100535 100407 100410 100168 100179 101161 101438
101051 100305 100148 100140 100672 100529 101061 100832 100313 101406 100917 100272 ...

output:

8504

result:

ok single line: '8504'

Subtask #4:

score: 56
Accepted

Dependency #3:

100%
Accepted

Test #23:

score: 56
Accepted
time: 27ms
memory: 28808kb

input:

7000 1
9999464
9999265
9998736
9996616
9994685
9994222
9991797
9990832
9989583
9989030
9982464
9981917
9981664
9980430
9977299
9976672
9975963
9975626
9974788
9970913
9969924
9967885
9967064
9965805
9964417
9962833
9962075
9959534
9958539
9955988
9955187
9954876
9953630
9952930
9952555
9951933
99517...

output:

24503500

result:

ok single line: '24503500'

Test #24:

score: 0
Accepted
time: 161ms
memory: 15432kb

input:

137 51
7053702 5532340 2942695 3891026 9508193 7207497 3343205 8071497 3015301 5033112 3361469 1555070 32629 3980935 7259422 2130107 9350230 8581089 8010931 8199178 3194921 4885372 6073265 1788690 442674 9445830 5739053 6840938 4259643 4613914 164471 2796366 2176418 2968526 3258289 2628707 5216588 5...

output:

29131

result:

ok single line: '29131'

Test #25:

score: 0
Accepted
time: 143ms
memory: 17736kb

input:

12 583
9151662 8534287 3966441 4867759 5676240 1406808 2309096 1072389 5352077 6063359 5972826 959020 2257572 9229523 1129473 3321488 1884411 4128454 352160 8530894 6646692 1156235 6465562 2380094 6913601 4732451 5592712 7753968 6675960 9972622 9320165 1945500 3926601 4898221 9812144 6651767 176215 ...

output:

28102

result:

ok single line: '28102'

Test #26:

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

input:

79 88
9999354 9998383 9995915 9991798 9988921 9987971 9985673 9983859 9983279 9983105 9982501 9981649 9981542 9980367 9979425 9979167 9977519 9977107 9976886 9976417 9975606 9967699 9964049 9959565 9959131 9957732 9956067 9955268 9950975 9947231 9946639 9946616 9941640 9940417 9939511 9939276 993614...

output:

12374560

result:

ok single line: '12374560'

Test #27:

score: 0
Accepted
time: 77ms
memory: 16128kb

input:

83 83
176 118592 255466 399080 533618 661850 762413 898033 1004783 1127595 1244701 1375518 1516007 1632379 1738578 1850047 1954478 2092761 2208804 2313705 2440205 2539761 2664209 2777022 2881675 2996149 3119442 3248442 3375415 3479558 3609360 3728835 3856610 3978236 4091957 4219700 4311607 4431162 4...

output:

571787

result:

ok single line: '571787'

Test #28:

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

input:

83 83
366497 366365 366280 365520 362359 361183 360716 359391 359276 356041 355720 352881 352521 350710 350626 349358 348582 348151 348046 346287 342174 342048 340720 340253 338054 336977 334789 332516 332221 326689 326624 325898 325206 317787 314912 313636 312839 312666 310078 310030 309467 308919 ...

output:

386670

result:

ok single line: '386670'

Test #29:

score: 0
Accepted
time: 83ms
memory: 16104kb

input:

82 82
256 772 1091 2965 7040 8200 10577 10953 11117 12869 12919 13948 17733 18227 19426 21498 21504 22907 23265 26294 28534 31085 31461 32077 32738 36176 37543 41848 43904 45015 46416 47578 49890 50451 51426 53255 60619 60948 61124 61637 63303 63809 67154 67987 69380 70920 72043 72905 73642 77913 79...

output:

372790

result:

ok single line: '372790'

Test #30:

score: 0
Accepted
time: 73ms
memory: 14980kb

input:

96 64
103754 103753 103750 103749 103738 103737 103734 103733 103690 103689 103686 103685 103674 103673 103670 103669 103498 103497 103494 103493 103482 103481 103478 103477 103434 103433 103430 103429 103418 103417 103414 103413 102730 102729 102726 102725 102714 102713 102710 102709 102666 102665 ...

output:

172746

result:

ok single line: '172746'

Test #31:

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

input:

97 72
100000 100001 100002 100015 100016 100017 100030 100031 100032 100045 100046 100047 100060 100061 100062 100075 100076 100077 100090 100091 100092 100105 100106 100107 100120 100121 100122 100135 100136 100137 100150 100151 100152 100165 100166 100167 100180 100181 100182 100195 100196 100197 ...

output:

80168

result:

ok single line: '80168'

Test #32:

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

input:

76 92
100000 100001 100002 100003 100016 100017 100018 100019 100032 100033 100034 100035 100048 100049 100050 100051 100064 100065 100066 100067 100080 100081 100082 100083 100096 100097 100098 100099 100112 100113 100114 100115 100128 100129 100130 100131 100144 100145 100146 100147 100160 100161 ...

output:

78172

result:

ok single line: '78172'

Test #33:

score: 0
Accepted
time: 138ms
memory: 15572kb

input:

97 72
100422 100588 101845 100447 100549 100894 100045 100420 100558 100700 101227 101337 100002 100029 100046 100267 100352 101861 100592 100807 101624 100614 102379 102562 100109 100436 100809 100130 100635 101045 101077 101531 102134 100489 100570 102256 100279 100395 100526 100072 100137 101286 ...

output:

47630

result:

ok single line: '47630'

Test #34:

score: 0
Accepted
time: 129ms
memory: 16116kb

input:

76 92
100266 100278 101556 101591 100162 100264 100388 100629 100429 100695 100787 100810 100016 100764 100821 100880 100400 100515 100692 101316 100024 100174 100577 100684 101054 101868 101994 102110 100291 100657 100820 100985 100077 100896 101013 101152 100029 100507 100884 101726 100127 100374 ...

output:

48440

result:

ok single line: '48440'

Subtask #5:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #35:

score: 20
Accepted
time: 406ms
memory: 143332kb

input:

50000 1
275
325
403
575
582
644
838
1069
1199
1267
1291
1686
1715
1816
1845
1909
1944
1960
2340
2347
2551
2938
3130
3151
3627
3663
3665
4030
4044
4381
4600
4810
5040
5168
5261
5537
5879
5953
5992
6261
6426
6589
7313
7392
7615
7879
7981
8071
8160
8219
8758
8825
8915
9020
9115
9369
9442
9488
9500
9662...

output:

1250025000

result:

ok single line: '1250025000'

Test #36:

score: 0
Accepted
time: 1326ms
memory: 54668kb

input:

1000 50
9416568 344620 6702318 3303199 4312507 9505915 9466580 315676 7418602 355319 3982290 3424793 7389219 3365 8911793 7477015 5606288 4987949 6410059 1174070 3586625 6137560 5089038 4688162 2250550 5182995 3749425 8575006 5534722 668139 5399175 3539373 7361820 1360004 2396326 6928392 9250787 212...

output:

210570

result:

ok single line: '210570'

Test #37:

score: 0
Accepted
time: 1421ms
memory: 54112kb

input:

210 238
5429811 4812188 4036317 1614684 8532468 9869507 9566269 4972447 3173508 4837561 708099 4543999 4765097 4083924 4214220 4947826 5313798 1066286 9597807 2567172 6982251 7008257 8144212 891078 3203378 606833 9741430 2045488 8912634 2044919 7836550 4453965 7737866 5450193 1207986 3682882 7155432...

output:

211384

result:

ok single line: '211384'

Test #38:

score: 0
Accepted
time: 542ms
memory: 99240kb

input:

2 25000
36 453 588 701 768 822 944 949 1048 1560 1580 1797 2114 2134 2272 2351 2470 2581 2600 2790 2820 2821 2827 2869 2880 3116 3216 3303 3792 3924 3963 4032 4228 4749 4971 5050 5400 5617 5636 5639 5913 5923 6131 6144 6268 6327 6467 6718 6719 6893 6981 7028 7171 7251 7579 7588 8578 8846 8874 8893 9...

output:

937537500

result:

ok single line: '937537500'

Test #39:

score: 0
Accepted
time: 1010ms
memory: 53108kb

input:

223 223
92 87665 87983 180417 180483 263875 263883 347843 348036 435445 435749 530963 531294 616372 616501 697554 697638 788056 788095 871492 871639 963079 963356 1057277 1057466 1147735 1147851 1241257 1241500 1332486 1332684 1420118 1420175 1507975 1508310 1599272 1599381 1688666 1688692 1778079 1...

output:

623800576

result:

ok single line: '623800576'

Test #40:

score: 0
Accepted
time: 986ms
memory: 54004kb

input:

223 223
636 46135 85261 130109 177326 219800 263461 305825 346016 388237 434309 475081 519359 565126 613061 662669 713593 763244 806625 848384 893894 936848 980578 1029468 1073745 1121504 1173281 1220686 1256369 1299943 1345722 1395682 1438615 1481506 1521002 1565714 1611933 1654429 1701999 1744269 ...

output:

11089567

result:

ok single line: '11089567'

Test #41:

score: 0
Accepted
time: 556ms
memory: 38296kb

input:

128 256
127306 127307 127308 127311 127312 127313 127326 127327 127328 127331 127332 127333 127386 127387 127388 127391 127392 127393 127406 127407 127408 127411 127412 127413 127626 127627 127628 127631 127632 127633 127646 127647 127648 127651 127652 127653 127706 127707 127708 127711 127712 12771...

output:

1106882

result:

ok single line: '1106882'

Test #42:

score: 0
Accepted
time: 965ms
memory: 53896kb

input:

384 128
100000 100001 100014 100015 100016 100019 100020 100021 100234 100235 100236 100239 100240 100241 100254 100255 100256 100259 100260 100261 100314 100315 100316 100319 100320 100321 100334 100335 100336 100339 100340 100341 103754 103755 103756 103759 103760 103761 103774 103775 103776 10377...

output:

1893030

result:

ok single line: '1893030'

Test #43:

score: 0
Accepted
time: 1107ms
memory: 54076kb

input:

220 225
100000 100001 100002 100003 100004 100025 100026 100027 100028 100029 100050 100051 100052 100053 100054 100075 100076 100077 100078 100079 100100 100101 100102 100103 100104 100125 100126 100127 100128 100129 100150 100151 100152 100153 100154 100175 100176 100177 100178 100179 100200 10020...

output:

1080977

result:

ok single line: '1080977'

Test #44:

score: 0
Accepted
time: 1196ms
memory: 54004kb

input:

225 220
100024 100003 100002 100001 100000 100049 100028 100027 100026 100025 100074 100053 100052 100051 100050 100099 100078 100077 100076 100075 100104 100103 100102 100101 100100 100129 100128 100127 100126 100125 100154 100153 100152 100151 100150 100179 100178 100177 100176 100175 100204 10020...

output:

826350

result:

ok single line: '826350'

Test #45:

score: 0
Accepted
time: 1086ms
memory: 52548kb

input:

220 225
100002 100003 100004 100005 100006 100027 100028 100029 100030 100031 100052 100053 100054 100055 100056 100077 100078 100079 100080 100081 100102 100103 100104 100105 100106 100127 100128 100129 100130 100131 100152 100153 100154 100155 100156 100177 100178 100179 100180 100181 100202 10020...

output:

655870

result:

ok single line: '655870'

Test #46:

score: 0
Accepted
time: 1180ms
memory: 54004kb

input:

225 220
100024 100023 100010 100009 100008 100047 100048 100035 100034 100033 100072 100071 100060 100059 100058 100095 100096 100085 100084 100083 100120 100119 100110 100109 100108 100143 100142 100135 100134 100133 100174 100173 100160 100159 100158 100197 100198 100185 100184 100183 100216 10021...

output:

891323

result:

ok single line: '891323'

Test #47:

score: 0
Accepted
time: 1105ms
memory: 53808kb

input:

220 225
110003 111638 112971 114432 115006 102909 103830 104514 104794 105528 100458 100640 108357 109849 114275 100587 101670 101928 103497 103666 100236 100282 102783 105071 106997 103123 103280 103592 111173 111785 100275 101049 102689 103069 103217 100511 103101 103613 108864 108940 101533 10248...

output:

412931

result:

ok single line: '412931'

Test #48:

score: 0
Accepted
time: 1283ms
memory: 53532kb

input:

225 220
149141 103196 102707 101303 100303 148294 108717 107676 105811 103719 144648 108675 107930 105361 103257 149010 103645 103506 101175 100134 106719 106139 105956 102372 100207 108564 107266 105127 104801 101061 110121 109408 108433 103942 103319 109393 105812 105122 104450 100558 109965 10839...

output:

403563

result:

ok single line: '403563'

Test #49:

score: 0
Accepted
time: 1191ms
memory: 53584kb

input:

220 225
100663 107193 107201 108932 112874 112886 116285 119186 120489 121273 104881 105013 106196 109516 111158 104549 106299 107986 107999 109825 107411 107690 108833 111565 113935 106783 110500 115793 118370 118881 104363 104384 105622 106355 106966 104620 108603 109135 109360 109988 104812 10499...

output:

405291

result:

ok single line: '405291'

Test #50:

score: 0
Accepted
time: 1302ms
memory: 52776kb

input:

225 220
148750 147301 119067 116799 116740 140014 141092 118281 117263 112991 145543 144115 119033 114838 113906 135833 137690 120300 119972 117959 143375 142971 118261 118106 115579 138055 137746 125952 124911 121310 144834 142078 122113 120199 117517 141849 146131 118174 117332 115443 136518 13501...

output:

410097

result:

ok single line: '410097'

Extra Test:

score: 0
Extra Test Passed