QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#108269 | #368. Natural Park | lmeowdn | 100 ✓ | 284ms | 4188kb | C++17 | 2.5kb | 2023-05-24 09:26:56 | 2023-05-24 09:26:59 |
Judging History
answer
#include "park.h"
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define fi first
#define se second
#define eb emplace_back
#define popc __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;
typedef unsigned long long ull;
typedef long double ld;
namespace {
const int N=1509;
int n,P[N],vst[N],in[N],rt,m,sz[N],msz[N],tot,f[N],qe,qr,qt[2],deg;
map<int,int>ed[N];
vi e[N],p;
}
void clear() {rep(i,0,n-1) P[i]=0;}
bool query_edge(int x,int y) {
clear(); P[x]=P[y]=1; if(x>y) swap(x,y); ++qe;
return Ask(x,y,P);
}
bool query_route(int x,int y,int m) {
clear(); P[x]=P[y]=1; if(x>y) swap(x,y); ++qr;
rep(i,m,n) if(!in[i]) P[i]=1;
return Ask(x,y,P);
}
bool query_tree(int x,int y,bool flag=0) {
clear(); P[x]=P[y]=1; if(x>y) swap(x,y); ++qt[flag];
for(int u:p) P[u]=1;
if(flag) rep(i,0,n-1) if(!in[i]) P[i]=1;
return Ask(x,y,P);
}
void adde(int x,int y) {
if(x>y) swap(x,y); Answer(x,y);
}
void dfs1(int u,int fa) {
sz[u]=1; f[u]=fa;
for(int v:e[u]) if(v!=fa&&!vst[v])
dfs1(v,u), sz[u]+=sz[v];
msz[u]=max(sz[u],m-sz[u]);
if(sz[u]!=m&&(rt==-1||msz[u]<msz[rt])) rt=u;
}
void dfs2(int u,int fa) {
sz[u]=1, p.eb(u);
for(int v:e[u]) if(v!=fa&&!vst[v])
dfs2(v,u), sz[u]+=sz[v];
}
int work1(int u,int z) {
m=sz[u]; rt=-1; dfs1(u,-1); if(rt==-1) return u;
p.clear(); dfs2(rt,f[rt]);
if(query_tree(rt,z,1)) return vst[f[rt]]=1, work1(rt,z);
else return vst[rt]=1, work1(f[rt],z);
}
bool work2(int u,int z,bool b=0) {
m=sz[u]; rt=-1; dfs1(u,-1); bool flag=0;
if(rt==-1) rt=u, flag=1;
else assert(f[rt]!=-1);
int ru=rt, ff=f[rt], su=sz[rt], sf=m-sz[rt];
p.clear(); dfs2(rt,-1);
if(b==0&&!query_tree(rt,z)) return 0;
if(flag) {adde(u,z); deg++; return 1;}
vst[ff]=1, vst[ru]=0; sz[ru]=su; b=work2(ru,z);
vst[ff]=0, vst[ru]=1; sz[ff]=sf; work2(ff,z,!b);
return 1;
}
void work(int l0,int x,int y) {
if(query_edge(x,y)) {
rep(i,0,n-1) vst[i]=0; in[y]=1; deg=0;
sz[0]=tot; work2(0,y); ++tot;
e[x].eb(y),e[y].eb(x); return;
}
int l=l0, r=n-1, w=0;
while(l<=r) {
int mid=l+r>>1;
if(query_route(x,y,mid)) w=mid, l=mid+1;
else r=mid-1;
}
work(w+1,x,w), work(w+1,w,y);
}
void Detect(int _t,int _n) {
n=_n; in[0]=1; tot=1;
rep(i,0,n-1) if(!in[i]) {
sz[0]=tot;
rep(i,0,n-1) vst[i]=0;
int y=work1(0,i);
work(0,y,i);
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 3788kb
input:
1 20 25 0 1 0 12 1 3 1 15 1 16 1 17 2 19 3 16 4 14 5 6 5 14 5 16 5 19 6 10 7 10 8 10 8 11 9 13 9 14 9 16 9 17 9 18 11 16 12 19 13 16
output:
Accepted
result:
ok
Test #2:
score: 0
Accepted
time: 8ms
memory: 3832kb
input:
1 250 300 0 145 0 164 1 41 1 92 2 123 2 196 3 30 3 144 4 80 4 238 5 131 5 192 6 209 7 38 7 168 8 11 8 90 8 97 9 21 9 46 9 231 10 92 10 159 10 164 10 202 10 239 12 20 12 160 12 215 13 139 14 166 15 62 15 121 15 145 15 162 16 26 16 60 16 66 16 114 16 190 16 195 17 68 17 116 17 120 18 107 19 31 19 55 1...
output:
Accepted
result:
ok
Test #3:
score: 0
Accepted
time: 7ms
memory: 3824kb
input:
1 250 280 0 88 0 176 1 205 2 21 2 80 3 231 3 248 4 8 4 151 4 164 5 7 5 14 5 52 5 64 6 26 6 120 6 148 7 234 8 234 9 53 10 46 10 106 10 112 11 39 11 59 11 151 12 43 13 52 13 131 15 127 16 84 16 166 17 85 17 125 17 187 17 203 18 100 19 113 19 149 19 203 20 211 21 140 22 61 22 124 22 158 23 226 23 229 2...
output:
Accepted
result:
ok
Test #4:
score: 0
Accepted
time: 11ms
memory: 4016kb
input:
1 250 500 0 101 0 146 1 72 1 80 1 95 1 212 2 19 2 149 2 154 2 213 2 230 2 247 3 54 3 150 3 248 4 11 4 20 4 98 4 167 4 195 4 234 5 145 5 191 5 202 5 241 6 43 6 84 6 164 6 221 7 54 7 101 7 197 8 49 8 93 8 122 8 193 9 47 9 52 9 209 10 53 10 127 10 206 10 236 11 36 11 45 11 110 11 228 12 157 12 173 12 2...
output:
Accepted
result:
ok
Test #5:
score: 0
Accepted
time: 13ms
memory: 3884kb
input:
1 250 874 0 7 0 23 0 40 0 180 0 203 0 231 0 247 1 11 1 130 1 134 1 141 1 167 1 212 1 248 2 82 2 95 2 126 2 149 2 155 2 181 2 187 3 8 3 17 3 58 3 104 3 139 3 183 3 241 4 79 4 88 4 91 4 113 4 115 4 143 4 238 5 9 5 24 5 52 5 70 5 106 5 230 5 234 6 32 6 48 6 128 6 169 6 171 6 200 6 201 7 86 7 89 7 128 7...
output:
Accepted
result:
ok
Subtask #2:
score: 10
Accepted
Test #6:
score: 10
Accepted
time: 140ms
memory: 3920kb
input:
2 1400 1399 0 729 1 956 1 1176 2 900 2 1012 3 1003 3 1031 4 279 4 491 5 367 5 773 6 18 6 1032 7 498 7 1069 8 699 8 1367 9 953 9 1141 10 898 10 1235 11 166 11 225 12 26 12 661 13 1159 13 1287 14 708 14 802 15 132 15 709 16 249 16 392 17 38 17 896 18 1223 19 1090 19 1312 20 554 20 810 21 219 21 330 22...
output:
Accepted
result:
ok
Test #7:
score: 0
Accepted
time: 184ms
memory: 3948kb
input:
2 1400 1399 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 5...
output:
Accepted
result:
ok
Test #8:
score: 0
Accepted
time: 149ms
memory: 4188kb
input:
2 1400 1399 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 5...
output:
Accepted
result:
ok
Test #9:
score: 0
Accepted
time: 133ms
memory: 4020kb
input:
2 1400 1399 0 976 1 996 1 1020 2 162 2 607 3 220 3 355 4 128 4 382 5 295 5 1174 6 379 6 1372 7 1242 7 1265 8 15 8 312 9 989 9 1141 10 493 10 1157 11 30 11 1329 12 264 12 864 13 1269 13 1349 14 759 14 1260 15 1340 16 1185 16 1261 17 107 17 621 18 246 18 691 19 542 19 1166 20 219 20 1209 21 70 21 854 ...
output:
Accepted
result:
ok
Test #10:
score: 0
Accepted
time: 140ms
memory: 3892kb
input:
2 1400 1399 0 1063 1 339 1 851 2 315 2 393 3 127 3 1266 4 566 4 947 5 6 5 1244 6 797 7 520 7 670 8 20 8 781 9 61 9 368 10 534 10 1238 11 937 11 1181 12 181 12 470 13 405 13 483 14 1071 14 1380 15 97 15 1264 16 694 16 1294 17 135 17 481 18 911 18 1308 19 460 19 736 20 799 21 1222 21 1278 22 142 22 83...
output:
Accepted
result:
ok
Subtask #3:
score: 27
Accepted
Test #11:
score: 27
Accepted
time: 197ms
memory: 3796kb
input:
3 1350 1349 0 75 0 571 0 689 0 906 0 1024 0 1090 0 1160 1 206 2 519 3 622 4 430 5 579 5 1041 6 369 6 601 6 759 7 526 8 381 9 384 9 1292 10 336 10 885 10 901 10 1254 11 491 11 745 12 574 12 1133 13 774 13 861 14 1098 15 1056 16 429 17 982 18 246 18 959 19 246 20 1071 21 32 21 1149 22 39 22 662 22 845...
output:
Accepted
result:
ok
Test #12:
score: 0
Accepted
time: 215ms
memory: 3800kb
input:
3 1400 1399 0 48 0 162 0 258 0 276 0 844 0 1185 1 639 1 1044 1 1174 1 1386 2 246 2 388 2 1207 2 1231 3 888 3 919 4 205 4 423 4 504 4 581 5 84 5 336 5 830 5 1256 5 1335 5 1399 6 1161 7 464 7 1267 8 1349 9 391 10 1181 11 191 12 151 12 997 13 482 14 451 15 626 16 1002 16 1234 17 1269 18 251 18 709 18 9...
output:
Accepted
result:
ok
Test #13:
score: 0
Accepted
time: 214ms
memory: 3860kb
input:
3 1400 1399 0 355 0 428 0 932 0 1152 0 1281 1 1302 2 11 2 270 2 271 2 1106 2 1205 3 506 4 18 4 731 5 251 5 485 5 727 6 79 6 946 6 1289 7 1201 8 1286 8 1344 9 778 10 775 12 329 13 1186 14 931 15 812 16 1251 17 938 17 1160 19 250 19 373 20 213 21 44 21 324 21 521 21 955 22 1299 23 536 23 778 24 887 24...
output:
Accepted
result:
ok
Test #14:
score: 0
Accepted
time: 205ms
memory: 3864kb
input:
3 1400 1399 0 35 0 1107 1 1093 2 386 3 1237 4 219 5 951 6 473 7 491 8 388 9 391 9 671 9 1253 10 1016 11 693 12 388 12 411 12 440 12 557 12 927 12 1068 12 1279 13 1003 14 1359 14 1376 15 1161 16 1373 17 299 17 422 18 633 19 1381 20 1037 20 1056 21 1004 22 995 22 1005 23 461 23 792 24 903 25 442 25 94...
output:
Accepted
result:
ok
Test #15:
score: 0
Accepted
time: 284ms
memory: 3936kb
input:
3 1400 1399 0 247 0 572 0 683 0 713 0 846 0 916 0 1306 1 348 2 231 2 541 3 603 4 65 4 430 4 1042 5 216 5 1220 5 1289 6 275 6 456 6 764 6 994 6 1368 7 947 8 222 8 804 8 938 9 180 9 414 10 1162 11 574 11 1055 12 533 12 1270 13 984 14 1100 14 1337 15 1087 16 1024 17 201 18 1025 19 867 20 632 20 1097 21...
output:
Accepted
result:
ok
Test #16:
score: 0
Accepted
time: 260ms
memory: 3872kb
input:
3 1400 1399 0 54 0 765 0 866 0 1167 0 1180 0 1189 0 1383 1 99 1 161 1 648 1 1087 2 299 2 349 2 701 2 1382 3 516 4 546 5 253 6 314 6 1042 7 1200 8 103 8 320 8 899 8 1017 9 508 10 473 10 1335 11 484 11 863 11 1244 12 350 12 1217 12 1280 13 980 14 50 15 872 16 127 16 579 16 1040 16 1370 16 1377 17 249 ...
output:
Accepted
result:
ok
Test #17:
score: 0
Accepted
time: 196ms
memory: 3920kb
input:
3 1400 1399 0 268 0 594 0 608 0 710 1 662 2 568 2 1199 3 394 3 973 3 1358 4 494 4 711 4 757 4 1055 5 848 6 731 6 831 6 1162 7 646 7 922 8 713 9 144 9 463 10 579 10 729 10 753 11 462 12 988 13 178 14 921 14 1243 15 1093 16 1126 17 344 17 374 17 746 17 878 17 1248 18 1360 19 1015 20 242 20 854 21 172 ...
output:
Accepted
result:
ok
Test #18:
score: 0
Accepted
time: 214ms
memory: 4096kb
input:
3 1400 1399 0 286 0 488 0 525 0 1062 0 1064 1 1153 2 460 2 886 3 514 3 677 3 1238 4 493 4 1391 5 667 6 1103 7 978 7 1073 7 1167 8 150 8 305 8 629 8 652 9 393 9 651 10 488 11 28 11 555 11 788 12 506 13 756 13 942 14 33 15 1184 16 890 17 1344 18 123 19 251 19 742 20 638 20 901 20 1366 21 341 22 850 22...
output:
Accepted
result:
ok
Subtask #4:
score: 30
Accepted
Test #19:
score: 30
Accepted
time: 99ms
memory: 3840kb
input:
4 1000 999 0 423 1 225 1 529 1 562 1 612 2 874 3 554 3 795 3 859 4 93 4 434 4 741 5 334 5 943 6 245 6 475 6 738 7 853 8 350 8 762 9 721 10 185 10 283 10 903 11 99 11 543 11 653 11 835 12 319 13 224 14 508 15 330 16 109 17 497 18 204 18 264 18 473 18 769 18 836 19 557 19 610 20 359 20 950 21 164 21 8...
output:
Accepted
result:
ok
Test #20:
score: 0
Accepted
time: 210ms
memory: 3976kb
input:
4 1400 1399 0 134 0 896 1 301 2 541 2 1026 3 184 4 281 4 649 5 710 5 1004 5 1351 6 1239 7 226 7 248 7 577 7 1256 7 1395 8 19 8 329 8 448 9 985 10 22 10 727 11 160 11 608 11 733 11 1295 12 57 12 115 13 302 13 972 13 1246 14 36 14 507 15 462 16 244 16 599 16 964 16 1138 16 1324 17 497 18 332 18 361 18...
output:
Accepted
result:
ok
Test #21:
score: 0
Accepted
time: 198ms
memory: 3932kb
input:
4 1400 1399 0 57 0 61 1 520 2 68 3 255 3 506 3 1044 4 1083 4 1278 5 579 6 138 6 1152 7 567 7 669 7 781 8 175 8 1158 9 195 9 1333 10 831 10 1387 11 1151 11 1204 12 64 12 69 12 988 13 1215 14 91 14 442 15 1245 16 445 16 1046 17 1112 17 1354 18 939 19 1130 20 379 21 456 22 303 22 851 22 1019 23 344 24 ...
output:
Accepted
result:
ok
Test #22:
score: 0
Accepted
time: 170ms
memory: 3868kb
input:
4 1400 1399 0 617 0 677 1 118 2 688 2 1201 3 298 4 710 4 989 5 352 5 1170 6 1179 6 1261 7 189 7 575 8 686 8 886 9 1253 9 1269 10 727 10 1340 11 35 11 135 12 281 12 1391 13 742 13 1064 14 972 14 1020 15 155 15 814 16 27 16 218 17 291 17 494 17 1372 18 34 19 1281 19 1282 20 643 20 877 21 860 21 1157 2...
output:
Accepted
result:
ok
Test #23:
score: 0
Accepted
time: 191ms
memory: 3996kb
input:
4 1400 1399 0 6 0 270 0 765 1 669 1 893 2 1298 3 463 3 1232 4 305 4 1058 5 217 5 1371 7 328 7 705 8 1263 9 1332 10 636 10 1277 11 609 11 985 12 729 13 23 13 94 13 479 13 627 13 1322 14 784 14 1214 15 51 15 1108 16 957 17 421 17 453 17 1079 18 1002 18 1060 19 103 19 1378 20 440 20 1240 21 1044 21 120...
output:
Accepted
result:
ok
Test #24:
score: 0
Accepted
time: 168ms
memory: 3912kb
input:
4 1400 1399 0 160 0 649 0 861 0 884 0 966 1 705 1 1237 2 175 2 1074 3 664 3 1042 3 1318 4 41 4 1300 4 1326 5 185 6 455 6 1300 7 365 7 895 7 1314 8 848 9 97 9 294 10 767 10 1062 10 1284 11 87 11 1167 12 952 13 848 13 879 13 1111 14 1261 15 808 15 1083 16 205 16 219 16 274 17 283 17 319 17 514 18 909 ...
output:
Accepted
result:
ok
Test #25:
score: 0
Accepted
time: 156ms
memory: 3904kb
input:
4 1400 1399 0 21 0 272 0 703 0 705 1 663 1 776 2 162 3 329 3 817 4 969 4 974 5 836 5 1332 6 1377 7 226 7 999 8 517 9 261 9 1171 10 686 10 958 11 95 11 233 12 172 12 533 12 1394 13 195 13 583 14 21 14 704 14 1011 14 1195 14 1371 15 1299 16 402 16 772 17 475 17 518 17 1058 18 279 18 1335 19 672 19 115...
output:
Accepted
result:
ok
Test #26:
score: 0
Accepted
time: 194ms
memory: 4048kb
input:
4 1400 1399 0 1106 1 43 1 1169 2 121 3 416 3 1187 4 126 4 281 4 586 4 1168 5 957 6 321 6 798 7 331 7 455 7 474 8 570 8 1281 9 60 9 1097 10 926 10 1318 11 71 11 272 11 877 12 904 13 1281 14 1306 15 310 16 371 16 539 17 123 17 513 18 717 18 1139 19 36 19 1322 20 116 20 405 21 618 21 688 22 449 22 662 ...
output:
Accepted
result:
ok
Test #27:
score: 0
Accepted
time: 182ms
memory: 4080kb
input:
4 1400 1399 0 60 0 899 1 327 2 746 3 474 3 744 3 905 3 960 3 1099 3 1226 4 470 4 1301 5 363 5 760 5 949 5 1311 6 419 6 783 7 92 7 684 8 183 8 263 8 1076 9 216 9 538 10 675 10 1332 11 271 11 979 12 244 13 660 14 243 14 1199 15 585 15 1111 16 955 16 1198 17 594 18 145 18 740 19 753 20 547 20 1101 21 9...
output:
Accepted
result:
ok
Test #28:
score: 0
Accepted
time: 178ms
memory: 3968kb
input:
4 1400 1399 0 926 0 1167 1 41 1 127 2 105 2 692 3 1051 4 70 4 777 4 850 5 266 5 431 6 803 6 1076 7 296 7 531 7 829 7 1187 7 1283 8 13 8 372 8 827 8 987 9 955 10 634 11 453 11 952 12 323 13 62 13 763 14 765 15 1233 15 1249 16 151 16 1398 17 179 17 1029 18 988 19 369 19 664 20 369 20 681 21 499 21 118...
output:
Accepted
result:
ok
Test #29:
score: 0
Accepted
time: 178ms
memory: 3952kb
input:
4 1400 1399 0 565 0 739 1 490 1 799 2 1201 3 267 4 729 4 1296 5 1037 5 1077 6 1231 6 1380 7 523 7 1169 8 409 9 864 9 903 10 861 10 1277 11 271 12 776 13 320 13 1289 14 588 15 401 15 668 16 274 17 184 17 1068 18 529 18 607 19 240 19 734 20 1053 20 1335 21 592 21 1378 22 1140 23 185 23 849 24 1037 25 ...
output:
Accepted
result:
ok
Test #30:
score: 0
Accepted
time: 204ms
memory: 4120kb
input:
4 1400 1399 0 475 0 1018 1 157 2 37 2 300 2 1306 3 104 4 990 5 208 6 1186 7 442 8 645 9 1023 9 1270 10 114 10 1233 11 673 12 363 12 820 12 976 12 1066 12 1301 12 1364 13 937 13 1275 14 824 14 856 14 1117 15 159 15 410 15 900 16 532 16 1228 16 1310 16 1385 17 160 17 163 17 265 18 285 18 513 19 1040 2...
output:
Accepted
result:
ok
Test #31:
score: 0
Accepted
time: 155ms
memory: 3984kb
input:
4 1400 1399 0 451 0 519 1 729 1 1035 2 324 3 1015 3 1329 4 362 4 1220 5 309 5 1027 6 269 6 1378 7 120 7 1254 8 69 8 1261 9 574 9 839 10 285 10 1141 11 70 11 1248 12 53 12 461 13 159 13 433 14 1050 15 870 15 1181 16 280 16 975 17 592 17 1299 18 678 18 683 19 347 19 919 19 1170 20 103 20 846 21 109 21...
output:
Accepted
result:
ok
Test #32:
score: 0
Accepted
time: 197ms
memory: 3896kb
input:
4 1400 1399 0 878 1 84 1 215 2 144 3 485 3 873 3 1000 4 71 4 865 4 1121 5 734 6 397 6 584 7 1121 8 323 9 486 10 125 10 170 10 177 10 236 11 90 11 96 11 304 11 694 11 774 11 883 12 464 12 654 12 860 13 517 14 970 14 1042 15 441 15 966 16 920 16 1183 17 855 18 27 19 751 20 474 20 663 21 612 21 665 21 ...
output:
Accepted
result:
ok
Test #33:
score: 0
Accepted
time: 142ms
memory: 3848kb
input:
4 1400 1399 0 35 0 718 1 1070 1 1213 2 533 2 604 3 725 3 904 4 150 4 328 5 1136 5 1383 6 110 6 508 7 52 7 1028 8 854 8 1111 9 836 9 890 10 78 10 1086 11 842 11 850 12 63 12 1014 13 428 13 1001 14 388 14 1143 15 152 15 957 16 990 16 1205 17 494 17 1153 18 515 18 903 19 203 19 271 20 411 20 1342 21 79...
output:
Accepted
result:
ok
Test #34:
score: 0
Accepted
time: 226ms
memory: 3836kb
input:
4 1400 1399 0 7 0 439 0 503 0 837 0 856 0 1042 1 403 1 471 1 776 1 856 2 476 3 1176 4 344 4 382 4 508 4 1369 5 377 5 912 5 1175 6 396 7 10 7 102 7 139 7 434 7 992 7 1307 8 111 8 245 8 581 8 844 8 1139 9 703 10 97 10 388 10 552 10 580 10 595 10 841 11 490 11 1100 12 374 13 682 14 449 14 932 15 23 16 ...
output:
Accepted
result:
ok
Test #35:
score: 0
Accepted
time: 139ms
memory: 4004kb
input:
4 1400 1399 0 1208 1 239 1 570 2 555 2 1393 3 952 3 1144 4 536 4 949 5 660 5 866 6 560 6 1302 7 232 7 524 8 340 8 566 9 900 9 1031 10 548 10 790 11 308 11 1102 12 134 12 932 13 477 13 1144 14 193 14 252 15 470 15 517 16 259 16 625 17 487 17 549 18 954 18 1171 19 286 19 721 20 577 20 746 21 1024 21 1...
output:
Accepted
result:
ok
Test #36:
score: 0
Accepted
time: 194ms
memory: 3968kb
input:
4 1400 1399 0 105 0 1199 1 1158 1 1316 2 93 2 98 3 1069 3 1270 4 1054 4 1093 5 606 6 264 6 274 6 546 6 591 6 700 6 811 6 1180 7 253 7 282 8 141 9 49 9 1187 10 1139 11 620 11 1390 12 757 12 1324 13 381 13 1154 14 502 15 96 15 290 15 521 16 71 17 715 17 856 18 446 18 531 18 711 18 718 19 423 19 799 20...
output:
Accepted
result:
ok
Test #37:
score: 0
Accepted
time: 152ms
memory: 3916kb
input:
4 1400 1399 0 1107 0 1168 1 313 1 699 2 886 2 1167 3 118 4 1199 4 1326 5 125 5 1103 6 888 6 1203 7 527 7 1311 8 1083 8 1277 9 141 9 492 10 1086 10 1314 11 35 11 286 11 522 12 332 12 1079 13 952 13 1092 14 131 14 715 15 381 15 804 16 1225 16 1358 17 555 17 689 18 719 18 1043 19 116 19 1240 20 109 20 ...
output:
Accepted
result:
ok
Test #38:
score: 0
Accepted
time: 183ms
memory: 3940kb
input:
4 1400 1399 0 348 1 934 1 1066 2 710 2 818 3 44 3 180 3 1009 4 359 4 1068 5 547 5 1324 6 602 6 877 7 590 7 1235 8 692 8 1219 9 120 10 64 10 656 11 96 11 164 12 796 12 1385 13 37 14 851 14 980 15 196 15 197 16 648 16 690 16 1106 17 605 18 802 18 1098 19 568 19 1334 20 25 20 231 21 215 21 334 21 1010 ...
output:
Accepted
result:
ok
Subtask #5:
score: 23
Accepted
Test #39:
score: 23
Accepted
time: 212ms
memory: 4100kb
input:
5 1350 1500 0 114 0 638 1 145 1 789 1 1196 2 120 3 981 3 1005 4 1143 4 1345 5 149 5 911 5 1300 6 275 6 1247 7 418 7 967 8 97 8 298 8 384 9 697 9 703 9 795 9 1087 10 110 10 294 10 1294 11 147 11 794 11 800 12 626 12 1234 12 1267 13 170 13 860 14 226 14 1132 15 248 15 818 16 287 16 1038 17 42 17 212 1...
output:
Accepted
result:
ok
Test #40:
score: 0
Accepted
time: 212ms
memory: 3940kb
input:
5 1400 1500 0 107 0 384 0 770 1 878 1 1054 1 1286 2 305 2 336 3 1011 3 1205 4 407 4 710 5 1360 5 1387 6 938 6 1248 7 49 7 721 8 879 8 904 9 536 10 777 10 783 10 956 11 40 11 188 12 1326 13 1256 13 1284 14 859 14 916 14 1170 15 544 15 816 16 198 16 880 16 1287 17 362 17 719 18 291 18 715 19 956 19 11...
output:
Accepted
result:
ok
Test #41:
score: 0
Accepted
time: 220ms
memory: 3836kb
input:
5 1400 1420 0 55 0 201 1 335 2 810 3 909 3 1286 4 71 5 589 5 922 6 897 7 420 7 478 7 863 7 1120 8 456 8 1012 8 1362 9 973 9 983 9 1238 10 674 10 1322 11 816 12 222 12 316 12 660 12 1024 13 1131 13 1191 13 1307 14 791 14 1270 15 163 16 851 17 461 17 633 18 410 18 803 19 1188 20 903 21 1111 21 1225 22...
output:
Accepted
result:
ok
Test #42:
score: 0
Accepted
time: 183ms
memory: 3948kb
input:
5 1400 1500 0 521 0 1033 1 358 1 736 2 1104 2 1349 3 1081 3 1351 4 79 4 663 4 1304 4 1395 5 239 5 1039 6 151 6 885 6 1164 7 335 7 361 7 865 8 226 8 455 8 576 9 114 9 186 10 904 11 240 11 972 12 253 12 583 13 201 14 17 14 1168 15 536 15 1097 16 146 16 301 16 350 16 741 16 868 16 1016 16 1377 17 638 1...
output:
Accepted
result:
ok
Test #43:
score: 0
Accepted
time: 224ms
memory: 4052kb
input:
5 1400 1500 0 392 0 1009 1 377 2 20 2 259 2 263 2 402 2 477 2 1327 2 1370 3 174 3 309 3 1218 4 710 5 621 6 207 6 870 6 1323 7 1352 8 322 9 387 9 851 10 317 10 471 11 517 11 954 12 26 12 251 12 1163 13 47 14 1299 15 628 15 945 16 124 16 1224 17 1241 17 1257 17 1338 18 51 18 868 18 956 19 185 20 81 20...
output:
Accepted
result:
ok
Test #44:
score: 0
Accepted
time: 147ms
memory: 3996kb
input:
5 1400 1500 0 616 0 1226 1 291 1 428 2 891 2 1218 3 63 3 1027 4 524 4 1174 5 686 5 793 5 1077 6 514 6 716 7 244 7 736 8 851 8 1213 8 1270 9 337 9 740 10 175 10 531 11 358 11 1303 12 521 12 689 13 443 13 1184 14 272 14 295 15 329 15 1344 16 220 16 888 17 1107 17 1196 18 89 18 110 19 525 19 1200 20 29...
output:
Accepted
result:
ok
Test #45:
score: 0
Accepted
time: 183ms
memory: 3844kb
input:
5 1400 1500 0 626 0 1354 1 213 1 1045 1 1326 2 149 2 1003 3 1031 4 176 4 1181 5 1258 6 57 6 788 7 1135 8 906 8 1357 9 1276 10 328 10 1082 11 168 11 237 12 596 13 306 13 1370 14 333 14 1151 15 433 15 580 16 213 16 287 16 340 17 33 17 1287 18 1224 18 1382 19 134 19 533 19 749 19 777 20 553 20 1034 21 ...
output:
Accepted
result:
ok
Test #46:
score: 0
Accepted
time: 174ms
memory: 3880kb
input:
5 1400 1458 0 551 0 647 0 1342 1 120 2 179 2 1156 3 15 3 1116 4 840 4 1304 5 524 5 812 6 85 6 1067 7 417 7 459 7 910 8 98 8 1374 8 1375 9 235 9 1078 10 261 11 1118 11 1386 12 283 12 355 12 417 12 556 12 1011 12 1171 12 1330 13 922 13 1140 14 522 14 981 15 85 16 1005 17 554 17 608 18 1135 18 1327 19 ...
output:
Accepted
result:
ok
Test #47:
score: 0
Accepted
time: 175ms
memory: 3908kb
input:
5 1400 1458 0 234 0 527 1 343 1 1053 2 1080 2 1233 2 1359 3 539 3 762 4 170 4 227 5 534 5 1339 6 260 6 630 7 885 7 1109 8 333 8 611 9 325 10 569 11 65 11 695 12 144 12 635 13 674 14 390 14 955 14 988 15 423 16 363 16 1334 17 154 17 568 18 80 18 540 18 897 18 1016 18 1186 19 734 19 878 20 407 20 1020...
output:
Accepted
result:
ok
Test #48:
score: 0
Accepted
time: 204ms
memory: 4112kb
input:
5 1400 1500 0 399 0 634 1 663 2 1069 2 1075 3 311 3 848 4 251 4 569 5 614 5 995 6 179 6 619 6 1238 7 271 7 847 7 1362 8 53 9 708 10 1113 10 1390 11 771 11 1312 12 840 13 456 13 1179 14 391 14 619 15 254 15 345 16 378 16 1046 17 90 18 793 18 1388 19 937 19 1361 20 1062 20 1091 20 1269 21 1125 21 1305...
output:
Accepted
result:
ok
Test #49:
score: 0
Accepted
time: 178ms
memory: 4124kb
input:
5 1400 1499 0 26 0 259 1 882 1 1305 1 1324 2 638 2 931 3 903 3 1122 4 163 4 900 5 412 5 1080 6 904 7 770 7 855 7 1281 8 191 8 575 8 1336 9 277 9 783 9 1081 10 505 11 83 11 1350 12 160 12 993 13 144 13 1387 14 419 14 1330 15 477 15 915 16 178 16 432 16 1228 17 1252 17 1289 18 1195 18 1349 19 504 20 7...
output:
Accepted
result:
ok
Test #50:
score: 0
Accepted
time: 176ms
memory: 4072kb
input:
5 1400 1500 0 120 0 460 1 642 1 878 2 234 2 330 2 763 3 318 3 1019 3 1042 4 494 4 1330 5 26 5 808 6 197 6 307 7 293 7 1067 8 438 9 743 9 1350 10 341 10 482 11 1110 12 735 12 1362 13 950 13 1058 14 213 14 438 14 1180 14 1339 14 1394 15 182 15 1387 16 217 16 1070 17 928 17 1012 17 1150 18 658 18 733 1...
output:
Accepted
result:
ok
Test #51:
score: 0
Accepted
time: 180ms
memory: 3796kb
input:
5 1400 1399 0 19 0 525 1 922 1 1175 2 353 3 512 3 852 3 1189 4 1006 4 1322 5 55 5 327 5 759 5 977 5 1092 5 1209 6 406 6 647 6 1152 7 992 7 1017 8 23 8 508 9 490 9 710 10 223 11 912 11 1377 12 569 12 657 13 401 14 209 15 723 16 29 16 1278 17 665 17 945 18 145 18 798 18 1036 19 441 19 540 19 605 20 31...
output:
Accepted
result:
ok
Test #52:
score: 0
Accepted
time: 219ms
memory: 4108kb
input:
5 1400 1500 0 355 0 558 1 572 1 1076 1 1256 2 144 2 213 2 716 3 305 3 307 3 400 3 1375 3 1398 4 403 4 796 5 93 5 574 5 1069 5 1197 6 1231 6 1259 7 681 7 1055 8 1293 9 217 9 256 9 1030 10 1067 10 1283 11 436 12 386 12 601 12 1230 13 108 13 1291 14 1049 15 402 15 1195 16 285 16 798 16 858 17 94 17 813...
output:
Accepted
result:
ok
Test #53:
score: 0
Accepted
time: 195ms
memory: 3844kb
input:
5 1400 1500 0 215 1 619 2 1239 3 927 3 998 3 1087 4 440 4 1306 5 643 6 800 7 316 7 645 7 802 8 666 9 98 9 217 9 1236 10 1241 11 446 12 419 12 711 12 934 12 1115 13 393 14 404 14 418 14 434 14 1138 14 1184 15 164 15 407 16 193 16 246 16 961 17 894 18 334 18 396 18 1299 19 1247 20 118 20 334 20 495 21...
output:
Accepted
result:
ok
Test #54:
score: 0
Accepted
time: 220ms
memory: 3928kb
input:
5 1400 1399 0 290 0 506 0 583 0 624 0 631 0 1145 0 1336 1 1361 2 798 2 1015 3 702 4 602 4 1334 5 1376 6 766 6 991 7 164 8 618 9 984 9 1318 10 581 11 424 12 358 13 116 13 393 14 1043 15 779 16 923 17 157 17 1159 18 290 19 60 20 73 21 949 22 1357 23 87 23 1389 24 559 24 588 24 601 24 723 24 1039 24 12...
output:
Accepted
result:
ok
Test #55:
score: 0
Accepted
time: 139ms
memory: 4056kb
input:
5 1400 1399 0 1165 1 19 1 488 2 300 2 689 3 206 3 343 4 182 4 1027 5 330 5 748 6 368 6 369 7 711 7 861 8 464 8 1149 9 841 9 1318 10 41 10 150 11 426 11 754 12 679 12 959 13 634 13 669 14 312 14 467 15 53 15 336 16 1191 16 1380 17 283 17 1361 18 458 18 898 19 1109 20 70 20 802 21 225 21 838 22 403 22...
output:
Accepted
result:
ok
Test #56:
score: 0
Accepted
time: 190ms
memory: 3952kb
input:
5 1400 1399 0 407 0 630 1 292 1 443 1 1074 2 1056 3 503 4 639 5 851 5 1357 6 971 7 1200 7 1254 8 1171 9 238 9 362 9 1224 9 1334 10 325 11 537 11 1067 11 1123 12 212 12 837 13 441 13 461 13 845 14 129 15 941 15 1081 16 550 17 575 18 387 18 820 18 1379 19 412 19 606 19 740 20 228 20 413 20 1074 21 97 ...
output:
Accepted
result:
ok
Extra Test:
score: 0
Extra Test Passed