QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#107345 | #6113. Window Arrangement | bulijiojiodibuliduo# | AC ✓ | 1341ms | 6656kb | C++ | 2.7kb | 2023-05-21 01:01:21 | 2023-05-21 01:01:25 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head
namespace mincost {
const int V=40100,E=1001000,_inf=0x20;
int q[V*30],vis[V],fst[V],pre[V],nxt[E],y[E],f[E],S,T,flow,tot,tn;
const ll inf=1ll<<60;
ll dis[V],c[E],cost;
void init(int s,int t,int Tn) {
tot=1; tn=Tn;
rep(i,0,tn) fst[i]=0;
S=s;T=t;
}
void add(int u,int v,int ff,int cc) {
tot++;y[tot]=v;nxt[tot]=fst[u];f[tot]=ff;c[tot]=cc;fst[u]=tot;
tot++;y[tot]=u;nxt[tot]=fst[v];f[tot]=0;c[tot]=-cc;fst[v]=tot;
}
bool spfa() {
rep(i,0,tn) dis[i]=inf,vis[i]=0,pre[i]=0;
dis[S]=0;q[0]=S;vis[S]=1;
int t=1;
rep(i,0,t) {
int u=q[i];
for (int j=fst[u];j;j=nxt[j]) {
int v=y[j];
if (f[j]&&dis[v]>dis[u]+c[j]) {
dis[v]=dis[u]+c[j];
pre[v]=j;
if (!vis[v]) vis[v]=1,q[t++]=v;
}
}
vis[u]=0;
}
return dis[T]!=inf;
}
void augment() {
int p=T, _f=1<<30;
while (pre[p]) _f=min(_f,f[pre[p]]),p=y[pre[p]^1];
flow+=_f;cost+=_f*dis[T];
p=T;
while (pre[p]) f[pre[p]]-=_f,f[pre[p]^1]+=_f,p=y[pre[p]^1];
}
void solve() {
flow=0,cost=0;
while (spfa()) augment();
}
}
const int N=55;
int n,m,p[N][N],w[N][N],id[N][N],row[N][N],col[N][N];
int main() {
scanf("%d%d",&n,&m);
rep(i,1,n+1) rep(j,1,m+1) scanf("%d",&p[i][j]);
rep(i,1,n+1) rep(j,1,m+1) scanf("%d",&w[i][j]);
int cc=0;
rep(i,1,n+1) rep(j,1,m+1) id[i][j]=++cc;
rep(i,1,n+1) rep(j,0,m+1) row[i][j]=++cc;
rep(i,0,n+1) rep(j,1,m+1) col[i][j]=++cc;
int S=0,T=++cc;
mincost::init(S,T,T+1);
rep(i,1,n+1) rep(j,1,m+1) {
mincost::add(S,id[i][j],w[i][j],0);
mincost::add(id[i][j],row[i][j-1],1,0);
mincost::add(id[i][j],row[i][j],1,0);
mincost::add(id[i][j],col[i-1][j],1,0);
mincost::add(id[i][j],col[i][j],1,0);
}
rep(i,1,n+1) rep(j,0,m+1) {
mincost::add(row[i][j],T,1,0);
mincost::add(row[i][j],T,1,p[i][j]*p[i][j+1]);
}
rep(j,1,m+1) rep(i,0,n+1) {
mincost::add(col[i][j],T,1,0);
mincost::add(col[i][j],T,1,p[i][j]*p[i+1][j]);
}
mincost::solve();
printf("%lld\n",mincost::cost);
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 5676kb
input:
4 3 1 7 10 7 2 8 7 9 10 4 6 4 3 3 3 3 2 4 4 3 4 2 2 3
output:
178
result:
ok 1 number(s): "178"
Test #2:
score: 0
Accepted
time: 2ms
memory: 5680kb
input:
4 3 2 2 9 9 8 4 8 4 5 7 5 2 0 1 0 1 0 1 0 0 1 0 1 0
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 18ms
memory: 5912kb
input:
20 20 755 344 600 54 516 407 657 429 565 185 90 323 449 464 872 138 404 500 196 111 666 191 824 98 505 538 949 801 266 861 984 957 396 851 496 147 225 451 874 380 536 200 581 397 305 514 351 416 228 763 566 442 618 131 527 651 954 757 226 129 286 608 819 477 891 22 19 747 565 704 198 703 736 8 835 1...
output:
14347279
result:
ok 1 number(s): "14347279"
Test #4:
score: 0
Accepted
time: 17ms
memory: 5908kb
input:
20 20 883 996 857 428 770 375 536 417 721 664 530 67 347 193 683 55 126 251 918 160 415 776 141 481 362 746 171 662 682 27 506 739 391 283 605 747 955 822 408 490 124 123 362 556 302 894 162 660 846 126 487 389 607 952 719 885 545 378 273 741 797 417 859 458 922 875 804 871 60 542 43 785 751 519 710...
output:
17832787
result:
ok 1 number(s): "17832787"
Test #5:
score: 0
Accepted
time: 15ms
memory: 5928kb
input:
20 20 12 841 115 905 831 152 815 405 876 550 673 811 141 138 710 972 745 513 936 400 355 554 651 160 219 658 688 419 699 897 925 305 978 420 418 451 685 897 645 705 225 533 655 10 491 681 974 904 568 889 305 737 997 772 423 119 432 703 424 545 204 34 194 840 954 241 589 291 659 676 400 571 470 735 4...
output:
10140249
result:
ok 1 number(s): "10140249"
Test #6:
score: 0
Accepted
time: 83ms
memory: 6008kb
input:
30 30 797 774 295 888 552 163 89 965 38 658 757 17 679 751 765 379 981 930 470 284 953 287 129 763 332 975 658 131 71 469 628 464 611 554 436 790 498 346 226 538 108 781 747 246 219 39 481 241 736 136 929 949 939 276 948 960 351 611 327 147 19 290 259 790 418 305 325 634 12 940 359 61 939 794 989 48...
output:
24175937
result:
ok 1 number(s): "24175937"
Test #7:
score: 0
Accepted
time: 76ms
memory: 6000kb
input:
30 30 925 618 41 366 101 428 72 953 193 136 197 760 577 992 576 296 896 488 192 333 597 361 638 147 189 695 880 992 383 340 855 247 199 987 545 390 227 421 463 944 209 895 528 893 215 418 101 485 354 602 43 705 224 904 844 898 237 232 886 655 426 396 298 364 449 967 110 758 803 482 908 143 954 602 8...
output:
36345958
result:
ok 1 number(s): "36345958"
Test #8:
score: 0
Accepted
time: 85ms
memory: 6028kb
input:
30 30 349 463 594 739 355 204 951 941 53 22 444 504 667 425 603 405 322 942 210 574 346 947 147 530 750 904 101 557 503 210 81 517 194 419 653 798 661 984 997 863 502 114 821 347 404 206 208 25 268 557 964 757 317 724 36 132 828 853 37 972 937 717 633 346 184 524 791 585 402 616 560 634 969 114 636 ...
output:
31921917
result:
ok 1 number(s): "31921917"
Test #9:
score: 0
Accepted
time: 76ms
memory: 6168kb
input:
30 30 773 603 852 217 416 981 231 225 912 205 588 544 758 962 222 322 237 500 932 518 94 428 952 105 311 112 618 905 816 376 499 891 589 555 762 398 687 59 938 270 603 228 602 506 593 481 724 565 694 728 78 1000 306 249 636 663 611 666 84 776 345 630 672 623 408 889 280 5 193 942 109 524 792 521 511...
output:
26614264
result:
ok 1 number(s): "26614264"
Test #10:
score: 0
Accepted
time: 148ms
memory: 6144kb
input:
30 30 336 905 393 891 816 387 961 566 524 281 843 444 349 981 28 136 307 622 626 5 629 895 178 573 642 966 218 403 307 677 536 675 854 13 321 77 285 966 611 597 21 24 708 662 592 486 784 554 491 526 887 955 32 370 996 382 221 577 783 515 364 974 684 238 489 576 786 705 855 57 229 256 515 120 685 91 ...
output:
154020136
result:
ok 1 number(s): "154020136"
Test #11:
score: 0
Accepted
time: 152ms
memory: 6124kb
input:
30 30 464 45 139 369 69 460 648 554 383 463 579 187 736 414 543 757 29 76 348 757 377 376 983 445 203 878 735 264 915 548 250 945 441 149 430 381 503 41 144 4 610 435 489 116 780 570 891 798 109 992 296 711 614 894 892 128 108 902 638 23 67 784 723 220 712 238 763 829 646 191 74 42 530 631 264 521 9...
output:
127330425
result:
ok 1 number(s): "127330425"
Test #12:
score: 0
Accepted
time: 152ms
memory: 6020kb
input:
30 30 888 593 397 39 835 428 632 246 539 645 723 931 826 951 866 674 943 634 70 998 126 154 300 828 764 86 957 613 36 714 476 24 732 877 539 85 936 116 86 115 414 357 269 571 777 653 407 338 831 651 114 955 411 10 892 363 699 523 389 827 578 697 58 498 744 795 548 248 949 29 431 124 545 143 140 951 ...
output:
144503495
result:
ok 1 number(s): "144503495"
Test #13:
score: 0
Accepted
time: 154ms
memory: 6004kb
input:
30 30 16 734 142 220 89 909 103 530 694 827 162 675 620 384 381 783 370 385 88 239 874 740 514 507 621 102 178 178 348 584 406 294 831 14 544 685 666 191 323 329 707 768 562 729 966 441 514 582 449 118 228 7 992 343 492 597 482 144 540 440 282 18 97 776 479 160 37 76 740 163 276 615 561 551 911 86 8...
output:
133057161
result:
ok 1 number(s): "133057161"
Test #14:
score: 0
Accepted
time: 153ms
memory: 6100kb
input:
30 30 756 758 410 391 362 933 81 834 557 688 707 327 424 206 531 271 793 985 337 425 289 33 505 309 183 193 811 159 269 641 788 482 954 122 524 522 702 421 527 409 705 997 652 915 908 48 889 353 934 746 852 394 728 673 939 262 138 874 438 137 4 891 439 710 325 575 705 9 656 365 982 548 754 481 768 4...
output:
174981485
result:
ok 1 number(s): "174981485"
Test #15:
score: 0
Accepted
time: 149ms
memory: 6024kb
input:
30 30 180 898 155 869 616 6 65 822 713 871 851 366 811 935 342 893 411 543 763 178 742 811 822 884 40 402 736 724 94 807 15 856 541 259 337 930 432 392 764 327 805 407 433 369 905 835 996 597 552 108 670 638 13 302 539 496 728 495 293 941 411 508 479 692 549 236 490 941 959 499 827 142 769 697 51 92...
output:
165187617
result:
ok 1 number(s): "165187617"
Test #16:
score: 0
Accepted
time: 149ms
memory: 6160kb
input:
30 30 604 743 413 50 973 975 944 810 572 349 586 814 901 176 369 810 134 294 781 419 682 589 331 563 601 610 254 73 702 677 433 831 832 691 150 338 161 763 2 734 802 522 22 824 797 919 512 137 466 871 80 690 811 122 731 434 615 116 636 258 922 317 518 970 284 898 171 65 46 825 184 928 784 209 118 63...
output:
189511101
result:
ok 1 number(s): "189511101"
Test #17:
score: 0
Accepted
time: 152ms
memory: 6212kb
input:
30 30 732 291 967 528 227 48 223 798 728 235 538 662 695 906 180 727 48 556 799 363 431 175 841 946 650 34 475 638 14 548 659 909 227 827 450 938 891 838 239 845 391 740 507 982 986 707 619 677 892 530 193 741 392 454 923 669 502 737 491 62 330 230 853 248 315 263 956 484 645 663 29 11 503 720 994 7...
output:
146279509
result:
ok 1 number(s): "146279509"
Test #18:
score: 0
Accepted
time: 103ms
memory: 6040kb
input:
50 20 7 6 1 3 2 6 6 4 7 7 4 1 8 4 1 7 1 4 9 5 5 4 3 10 6 5 1 10 4 1 6 5 8 6 2 7 6 5 3 5 4 3 4 10 4 7 7 8 6 6 4 7 9 6 3 2 5 7 10 1 6 9 5 4 3 8 6 5 10 7 3 10 10 7 9 8 3 5 10 6 3 5 10 9 8 4 3 3 10 6 1 1 9 8 4 9 4 7 6 3 2 8 8 4 5 3 6 7 6 9 4 1 8 7 9 3 5 6 10 8 3 9 3 1 3 4 8 3 5 4 9 4 3 5 7 9 10 4 1 1 4 ...
output:
5096
result:
ok 1 number(s): "5096"
Test #19:
score: 0
Accepted
time: 645ms
memory: 6576kb
input:
50 45 7 9 9 1 6 9 1 4 5 8 5 9 9 2 7 10 3 9 3 4 10 2 7 10 4 2 4 7 10 10 8 4 7 4 6 10 8 7 8 9 9 8 4 1 4 6 7 5 6 10 3 9 9 10 4 3 8 3 5 1 9 2 3 10 3 4 8 6 4 7 6 6 2 5 2 10 2 4 7 3 5 2 3 9 6 6 1 7 7 3 3 1 6 6 6 3 3 9 6 3 6 1 8 6 2 4 3 6 4 2 4 3 8 3 3 8 2 2 4 2 2 2 2 4 1 3 10 1 5 8 3 3 1 8 6 2 5 9 5 3 8 5...
output:
10959
result:
ok 1 number(s): "10959"
Test #20:
score: 0
Accepted
time: 625ms
memory: 6568kb
input:
45 50 10 10 8 7 1 1 10 10 10 8 7 9 1 5 4 7 9 10 7 10 4 4 5 10 9 4 9 9 2 7 6 8 2 5 3 2 2 7 9 3 5 4 9 3 4 1 2 7 6 9 9 1 1 6 3 9 3 10 7 3 2 7 9 4 3 9 3 1 10 3 6 10 2 9 3 5 4 5 4 7 6 5 2 2 8 4 10 2 8 1 1 5 9 9 4 6 5 1 6 6 10 7 2 1 5 7 4 9 7 5 10 5 3 6 8 1 9 8 5 4 2 8 6 7 10 7 3 9 5 2 3 4 9 9 2 1 7 8 6 2...
output:
10532
result:
ok 1 number(s): "10532"
Test #21:
score: 0
Accepted
time: 806ms
memory: 6656kb
input:
50 50 2 4 5 2 9 8 6 10 2 3 6 8 7 2 5 3 4 5 5 9 10 5 3 9 2 5 9 3 6 1 6 1 10 9 4 5 5 5 6 4 4 9 5 5 7 9 2 9 3 6 10 4 10 8 8 6 5 6 5 10 10 5 6 1 10 9 2 4 3 1 2 7 1 8 3 10 1 7 6 4 6 8 7 3 5 8 7 4 5 1 10 10 7 5 9 8 3 7 10 7 3 2 10 6 4 9 3 5 4 1 6 7 2 8 10 9 3 10 7 9 9 4 7 9 3 9 2 5 1 3 3 5 9 4 9 9 5 4 7 9...
output:
11611
result:
ok 1 number(s): "11611"
Test #22:
score: 0
Accepted
time: 779ms
memory: 6652kb
input:
50 50 2 8 8 7 9 1 5 2 1 1 4 5 7 9 4 10 6 3 1 10 8 9 2 2 9 4 6 4 9 1 2 1 7 5 9 9 10 10 7 7 5 2 4 3 4 7 8 3 7 9 7 8 4 8 10 6 6 7 2 4 1 10 1 9 3 4 7 8 5 5 1 7 6 2 10 4 2 10 9 10 9 8 3 1 8 2 9 1 5 10 8 10 9 10 8 6 1 4 4 3 2 9 1 9 6 1 7 10 9 2 3 1 4 9 2 10 6 10 5 5 5 9 5 3 7 3 6 1 8 9 7 1 7 1 9 6 10 5 10...
output:
11341
result:
ok 1 number(s): "11341"
Test #23:
score: 0
Accepted
time: 780ms
memory: 6648kb
input:
50 50 10 8 4 9 10 10 4 6 1 3 7 9 7 2 5 9 1 7 9 7 9 4 1 2 10 10 7 1 9 8 4 10 8 8 8 3 4 1 5 8 4 2 5 8 2 10 5 3 1 2 1 4 9 8 6 4 5 10 1 7 8 1 6 7 9 9 6 9 6 4 3 10 3 3 10 4 2 7 4 7 3 3 9 5 3 4 1 1 6 6 8 3 10 5 7 1 9 5 6 4 5 9 2 4 1 3 8 3 5 4 9 10 6 8 6 5 8 3 2 1 10 5 6 3 4 4 6 3 6 4 9 6 8 10 8 6 10 7 1 3...
output:
9600
result:
ok 1 number(s): "9600"
Test #24:
score: 0
Accepted
time: 752ms
memory: 4808kb
input:
50 50 8 1 2 7 4 7 8 8 6 9 7 9 9 3 2 10 7 5 7 8 1 2 5 9 1 2 3 2 8 8 2 10 5 4 1 3 10 5 2 2 9 7 10 2 9 4 1 7 7 5 5 2 4 7 6 9 2 5 3 5 2 6 2 7 10 7 3 9 5 8 2 6 8 9 5 5 8 4 7 1 4 9 6 9 8 4 5 4 6 5 8 1 7 2 2 1 5 7 10 6 2 7 5 7 5 9 3 10 10 5 6 5 8 8 10 6 7 5 10 9 5 4 8 7 4 8 9 10 10 6 7 8 10 9 4 3 1 4 10 1 ...
output:
9049
result:
ok 1 number(s): "9049"
Test #25:
score: 0
Accepted
time: 1331ms
memory: 4864kb
input:
50 50 1 5 2 9 6 4 6 7 7 7 6 6 4 5 6 8 7 2 1 10 3 9 9 5 4 5 10 9 6 10 2 1 7 7 10 2 5 4 3 9 5 3 6 6 1 9 4 5 3 8 6 5 6 4 4 6 4 9 8 6 6 3 7 1 5 3 3 6 1 10 2 3 7 6 9 4 3 1 5 6 10 9 5 4 2 6 6 8 7 10 2 4 6 9 10 4 4 7 10 6 2 4 7 7 9 4 10 9 6 6 5 2 7 5 5 8 8 3 1 10 7 7 1 5 10 8 3 1 4 6 9 2 9 10 8 7 3 5 8 1 1...
output:
55739
result:
ok 1 number(s): "55739"
Test #26:
score: 0
Accepted
time: 1330ms
memory: 4928kb
input:
50 50 9 10 6 9 9 3 10 5 2 9 5 10 5 8 5 5 9 8 3 1 2 7 7 5 5 3 1 8 4 10 10 1 4 9 7 10 4 9 7 10 8 3 7 5 10 7 9 5 1 1 4 7 9 2 4 1 5 10 5 10 7 6 2 9 8 9 2 10 10 6 4 3 2 9 4 8 3 2 8 8 7 9 5 2 6 4 10 5 7 9 10 10 7 4 9 9 2 8 2 6 5 8 8 2 6 6 9 10 1 1 9 3 9 10 1 9 8 7 7 7 5 3 4 5 3 2 10 7 8 10 8 8 9 3 2 2 10 ...
output:
53476
result:
ok 1 number(s): "53476"
Test #27:
score: 0
Accepted
time: 1334ms
memory: 4884kb
input:
50 50 3 8 1 10 1 6 3 3 8 8 5 1 9 6 4 2 4 10 1 5 4 3 2 8 6 1 2 3 5 1 2 10 5 1 9 10 4 4 8 5 5 6 8 9 8 1 5 5 5 3 4 9 4 3 10 5 2 5 6 2 1 9 7 5 3 4 3 4 9 10 3 3 5 1 5 5 9 9 1 6 8 1 6 6 7 2 1 7 10 8 4 7 8 9 8 5 10 10 10 2 6 2 9 3 10 8 9 5 7 2 8 2 1 3 9 2 10 10 6 3 10 4 10 9 1 6 10 8 9 7 10 4 7 2 8 9 7 3 3...
output:
49141
result:
ok 1 number(s): "49141"
Test #28:
score: 0
Accepted
time: 1341ms
memory: 4916kb
input:
50 50 1 3 9 8 5 3 2 1 7 10 8 1 9 9 3 1 6 1 3 4 5 4 1 7 3 8 9 3 7 9 2 10 10 8 8 8 8 5 6 5 1 6 7 6 5 6 10 1 3 6 1 3 7 5 6 3 2 6 5 10 6 2 6 6 4 1 4 7 10 4 8 6 10 7 1 9 5 2 6 8 2 8 10 4 4 5 3 8 4 7 2 9 7 4 3 7 6 1 2 6 1 6 10 10 3 4 8 8 2 5 4 6 5 1 3 3 9 8 1 7 6 4 8 9 7 4 8 4 3 9 2 10 2 9 9 5 8 5 6 9 5 6...
output:
49743
result:
ok 1 number(s): "49743"
Test #29:
score: 0
Accepted
time: 1299ms
memory: 4760kb
input:
50 50 2 9 7 9 4 9 5 9 7 2 8 10 5 2 2 9 7 2 6 4 10 6 2 3 9 3 2 10 6 7 10 5 8 3 7 9 7 6 5 7 7 1 10 7 8 4 3 9 7 9 9 1 5 9 3 2 4 9 2 8 7 2 4 8 1 3 3 4 4 10 4 3 4 7 5 9 10 8 5 10 8 10 1 4 9 8 4 7 6 10 9 3 8 6 8 4 2 9 7 3 7 6 3 3 9 4 4 4 9 7 5 8 9 1 7 7 8 9 1 1 7 8 6 10 4 3 6 10 9 8 9 3 3 1 6 2 8 9 9 6 1 ...
output:
56108
result:
ok 1 number(s): "56108"
Test #30:
score: 0
Accepted
time: 1307ms
memory: 4760kb
input:
50 50 10 3 3 1 6 3 10 7 2 4 1 10 6 3 3 6 1 6 8 9 9 10 10 6 10 9 3 1 8 7 6 3 3 5 2 5 7 5 7 1 4 9 5 6 7 10 1 3 5 1 3 3 9 3 9 4 4 4 7 4 10 5 3 1 2 8 1 4 3 4 7 5 3 3 7 5 10 1 8 6 9 2 7 8 4 8 2 4 6 3 7 7 7 1 7 1 10 7 3 7 4 2 8 10 1 10 3 7 6 2 5 7 1 10 5 2 10 8 8 8 3 4 4 9 6 1 6 1 5 4 1 9 7 6 7 8 9 4 1 5 ...
output:
58373
result:
ok 1 number(s): "58373"
Test #31:
score: 0
Accepted
time: 1310ms
memory: 4932kb
input:
50 50 10 8 7 10 9 10 7 9 8 7 1 3 10 2 10 9 8 4 6 7 7 10 5 7 7 2 10 6 5 7 2 8 4 2 4 3 6 6 10 8 5 3 10 2 6 7 2 9 7 4 5 4 4 10 5 9 1 5 10 9 8 6 8 3 3 6 6 8 4 8 6 1 8 5 2 9 6 4 5 10 3 8 4 1 6 4 4 10 4 2 5 4 9 1 6 3 6 8 7 1 8 6 9 1 10 6 8 4 10 4 10 8 3 5 9 3 9 10 6 4 4 5 2 3 6 9 6 3 3 7 5 4 6 9 3 5 5 2 4...
output:
57541
result:
ok 1 number(s): "57541"
Test #32:
score: 0
Accepted
time: 1278ms
memory: 4944kb
input:
50 50 8 2 6 2 7 3 9 3 7 9 1 1 10 7 1 6 6 8 8 2 8 7 4 10 4 10 1 9 1 3 6 2 1 4 5 3 10 1 8 9 4 4 5 7 2 1 4 2 5 7 8 8 9 2 7 7 8 8 9 3 9 1 7 9 8 7 3 2 3 6 10 8 3 6 1 9 2 1 10 8 6 1 4 9 7 2 1 7 3 8 3 10 10 2 5 7 4 9 9 7 1 1 2 8 4 2 4 3 7 5 4 3 6 3 5 8 1 1 5 8 2 7 10 3 10 3 6 9 8 1 7 6 6 6 3 6 6 3 5 9 3 10...
output:
56369
result:
ok 1 number(s): "56369"
Test #33:
score: 0
Accepted
time: 1111ms
memory: 4828kb
input:
50 50 994 478 621 47 258 702 48 709 325 437 589 483 431 49 309 64 259 541 443 819 743 753 463 739 139 805 731 414 806 378 616 875 313 977 194 56 649 833 296 4 321 45 757 606 390 324 834 500 577 576 425 981 353 983 867 784 70 661 756 43 959 432 842 533 45 75 897 987 246 707 569 71 795 589 902 12 266 ...
output:
1256165665
result:
ok 1 number(s): "1256165665"
Test #34:
score: 0
Accepted
time: 2ms
memory: 3792kb
input:
1 1 1 4
output:
0
result:
ok 1 number(s): "0"
Test #35:
score: 0
Accepted
time: 707ms
memory: 4892kb
input:
50 50 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000...
output:
2427000000
result:
ok 1 number(s): "2427000000"
Test #36:
score: 0
Accepted
time: 5ms
memory: 4776kb
input:
50 50 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000...
output:
0
result:
ok 1 number(s): "0"
Test #37:
score: 0
Accepted
time: 249ms
memory: 4848kb
input:
50 50 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000...
output:
1000000
result:
ok 1 number(s): "1000000"