QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#745212 | #8643. Board Game | 275307894a | 17 | 2025ms | 50036kb | C++14 | 4.7kb | 2024-11-14 08:20:33 | 2024-11-14 08:20:33 |
Judging History
answer
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=5e4+5,M=N*4+5,K=1000+5,mod=1e9+7,Mod=mod-1;const db eps=1e-9;const ll INF=5e18+7;mt19937 rnd(28382);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
#ifdef LOCAL
#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
#else
#define gdb(...) void()
#endif
}using namespace Debug;
int n,m,k,X[N],w1[N],w2[N];
vector<int> S[N];
char s[N];
namespace Init{
int d1[N],d2[N];
void build(){
Me(d1,0x3f);
priority_queue<pii> q;
for(int i=1;i<=n;i++) if(s[i]=='1') d1[i]=-2,q.emplace(2,i);
while(!q.empty()){
auto [w,x]=q.top();w*=-1;q.pop();
if(w^d1[x]) continue;
for(int i:S[x]) if(d1[i]>w+1) q.emplace(-(d1[i]=w+1),i);
}
Me(d2,0x3f);
for(int i=1;i<=n;i++) if(s[i]=='1') for(int j:S[i]) if(s[j]=='1'&&d2[i]>0) d2[i]=-1,q.emplace(1,i);
while(!q.empty()){
auto [w,x]=q.top();q.pop();w*=-1;
if(w^d2[x]) continue;
for(int i:S[x]){
int v=w+(s[i]^'1');
if(d2[i]>v) q.emplace(-(d2[i]=v),i);
}
}
// for(int i=1;i<=n;i++) if(d1[i]>=n) gdb(d1[i],d2[i]);
for(int i=2;i<=k;i++) w1[i]=(d1[X[i]]==-2?0:d1[X[i]]),w2[i]=max(d2[X[i]]+(s[X[i]]=='1'),0);
// gdb(d1[X[k]],w1[k]);
}
}
ll ans[N],flag[N];
void build(){
queue<int> q;
static int d[N];
Me(d,0x3f);d[X[1]]=0;q.push(X[1]);
while(!q.empty()){
int x=q.front();q.pop();
if(s[x]=='1'&&x^X[1]) continue;
for(int i:S[x]) if(d[i]>d[x]+1) d[i]=d[x]+1,q.push(i);
}
for(int i=1;i<=n;i++) if(d[i]<=n) ans[i]=d[i],flag[i]=1;
}
namespace Solve1{
ll f[305],d[N];
void Solve(){
Me(f,0x3f);f[0]=0;
for(int i=2;i<=k;i++){
gdb(w1[i],w2[i]);
for(int j=i;~j;j--) f[j]=min(f[j]+w2[i],(j?f[j-1]:INF)+w1[i]);
}
for(int i=0;i<k;i++){
Me(d,0x3f);
// gdb(i,f[i]);
priority_queue<pair<ll,int> > q;
d[X[1]]=f[i];q.emplace(-f[i],X[1]);
while(!q.empty()){
auto [w,x]=q.top();q.pop();w*=-1;
if(w^d[x]) continue;
if(!i) gdb(x,d[x]);
for(int j:S[x]){
ll v=w+(s[j]=='1'?i+k-1:0)+1;
if(d[j]>v) q.emplace(-(d[j]=v),j);
}
}
static ll dw[N];
Mc(dw,d);Me(d,0x3f);
for(int j=1;j<=n;j++)if(s[j]=='1'&&j^X[1]){
for(int h:S[j]){
ll v=dw[j]+(s[h]=='1'?i+k-1:0)+1;
if(d[h]>v) q.emplace(-(d[h]=v),h);
}
}
while(!q.empty()){
auto [w,x]=q.top();q.pop();w*=-1;
if(w^d[x]) continue;
if(!i) gdb(x,d[x]);
for(int j:S[x]){
ll v=w+(s[j]=='1'?i+k-1:0)+1;
if(d[j]>v) q.emplace(-(d[j]=v),j);
}
}
for(int j=1;j<=n;j++) ans[j]=min(ans[j],d[j]-(s[j]=='1'?i+k-1:0));
gdb(d[1],flag[1]);
// if(f[i]<=1e9) gdb(d[585],f[i]);
}
}
}
namespace Solve2{
int mi[N];
const int B=200;
int d[N][B+5];
ll f[N+B];
void Solve(){
Me(mi,0x3f);
deque<int> q;
mi[X[1]]=0;q.push_back(X[1]);
while(!q.empty()){
int x=q.front();q.pop_front();
for(int i:S[x]){
int v=mi[x]+(s[i]=='1');
if(mi[i]>v){
mi[i]=v;
if(v==mi[x]) q.push_front(i);
else q.push_back(i);
}
}
}
Me(d,0x3f);d[X[1]][0]=0;
q.push_back(X[1]*(B+5));
while(!q.empty()){
int u=q.front();q.pop_front();
int x=u/(B+5),y=u%(B+5);
gdb(x,y,d[x][y]);
for(int i:S[x])if(int u=y+mi[x]-mi[i]+(s[i]=='1');u<=B){
int v=d[x][y]+1;
gdb(u);
if(d[i][u]>v) d[i][u]=v,q.push_back(i*(B+5)+u);
}
}
for(int i=0;i<=n+B;i++){
for(int j=2;j<=k;j++) f[i]+=min(2*i+w1[j],i+w2[j]);
}
gdb(d[5][0],mi[5],f[1]);
for(int i=1;i<=n;i++){
for(int j=max(1+(s[i]=='1'),mi[i]);j<=mi[i]+B;j++){
ans[i]=min(ans[i],d[i][j-mi[i]]+f[j-(s[i]=='1')]);
// if(j<=3) gdb(d[i][j],i,j);
}
}
}
}
void Solve(){
scanf("%d%d%d",&n,&m,&k);
for(int i=1;i<=m;i++){
int x,y;scanf("%d%d",&x,&y);
S[x].push_back(y);S[y].push_back(x);
}
scanf("%s",s+1);
for(int i=1;i<=k;i++) scanf("%d",&X[i]);
Init::build();
Me(ans,0x3f);
build();
/*if(k<=300) Solve1::Solve();
else */Solve2::Solve();
for(int i=1;i<=n;i++) printf("%lld\n",ans[i]);
}
int main(){
int t=1;
// scanf("%d",&t);
while(t--) Solve();
cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}
詳細信息
Subtask #1:
score: 3
Accepted
Test #1:
score: 3
Accepted
time: 7ms
memory: 47540kb
input:
3000 3000 3000 2378 2385 1560 2450 189 2980 44 1140 425 1843 167 1563 439 2010 7 951 1311 1370 1305 2085 150 1600 16 2469 431 2674 317 2191 1845 2918 2195 2917 1210 1577 125 1049 911 1160 504 2060 376 2420 1676 2969 1343 1576 284 1869 835 1989 273 1330 234 1906 1482 1524 2415 2460 388 2897 2177 2600...
output:
76 52 40 54 67 54 62 36 44 32 60 61 58 29 34 22 64 25 31 33 14 79 80 58 68 29 67 69 47 60 48 55 45 11 24 51 17 24 47 29 50 57 89 54 62 63 55 61 7 41 61 27 64 60 63 55 44 43 39 48 57 47 65 65 55 43 51 48 22 57 47 28 52 51 50 61 41 61 69 50 41 53 42 58 45 26 60 52 30 56 47 56 32 55 44 58 56 71 69 41 6...
result:
ok 3000 lines
Test #2:
score: 3
Accepted
time: 682ms
memory: 48916kb
input:
30000 30000 30000 11640 15443 5731 12870 5066 28442 11803 29263 2399 20658 4911 11282 676 1962 10390 19686 6117 6722 22155 28614 2932 14721 11403 13488 6697 22434 19113 26975 20347 20663 15743 16072 19116 25652 10891 19389 1373 27384 14607 29107 6192 29223 7196 10267 15467 16280 21828 26032 365 982 ...
output:
2610 3673 15 7659 10149 8209 878 4102 7582 10483 6418 6826 11546 12814 11394 7792 9097 7484 14575 913 5802 584 8172 961 7434 8828 14665 7642 14032 6284 8299 3040 9576 4953 47 13721 10634 3362 9103 4901 4022 11866 14548 5132 9252 13165 143 9494 2845 13149 5616 3023 13560 12315 8126 2002 5706 10657 14...
result:
ok 30000 lines
Test #3:
score: 3
Accepted
time: 1903ms
memory: 49704kb
input:
50000 49999 50000 23237 38489 46903 47222 463 17722 5061 37126 21771 23294 4851 25450 408 41933 1298 5353 8952 44686 5842 17741 15835 33052 16401 17274 33117 33174 7070 24079 22424 46115 5336 6340 35165 36940 3308 36325 12014 20182 391 48629 9736 42693 5246 46582 22861 48389 3338 6669 31354 49668 11...
output:
8988 372 12633 8934 15728 15677 431 10910 20467 16345 10441 16923 12383 15090 11112 19353 21485 9819 17810 3071 41 99 8479 9616 1173 13790 1142 14800 19055 675 1086 2353 22330 18271 2373 11286 20247 21236 18133 11260 2792 19399 9049 18056 14190 3523 22890 19479 14288 9335 561 19226 12836 11409 8485 ...
result:
ok 50000 lines
Test #4:
score: 3
Accepted
time: 38ms
memory: 50036kb
input:
49900 50000 100 21419 22725 19367 26559 4942 22766 16196 32249 12443 43575 17415 32668 3559 30282 6024 31186 4553 32107 1085 24970 27857 48472 15126 48937 22784 33748 16961 18301 21066 30382 41567 46191 17677 42298 2910 32294 14609 16464 14131 44143 8413 13472 17266 18767 567 48263 2410 29825 22159 ...
output:
4729 6824 18742 805 16289 4349 1296 5007 15785 15606 18374 4228 1685 19748 16689 7552 13232 5985 19529 7256 13074 6094 12823 7464 19302 3985 5081 4794 2513 6637 10664 6726 11115 11493 10542 4882 2626 10108 17287 690 8100 6464 10436 3789 14356 11646 18179 20174 19124 1188 20268 1232 4167 127 1224 166...
result:
ok 49900 lines
Subtask #2:
score: 7
Accepted
Test #5:
score: 7
Accepted
time: 17ms
memory: 48424kb
input:
3000 3000 3000 1391 1542 299 1578 1346 1528 46 1259 1513 2261 201 1717 56 1635 199 2327 847 882 1977 2161 465 1954 1723 2580 482 2105 906 2207 747 2742 2026 2845 1565 1809 295 311 278 2408 1215 2583 520 832 464 638 1223 1346 1799 2703 1022 2717 887 2160 619 2109 165 2478 879 1343 319 2463 56 815 109...
output:
25 47 29 15 51 29 39 23 47 39 23 39 27 39 5 39 19 26 30 31 43 32 39 86790 24 13 86787 52 31 24 36 22 33 31 32 22 36 43 24 25 30 32 86793 31 49 34 31 31 39 21 33 86793 34 40 23 43 44 37 32 37 48 86790 33 86783 42 46 28 86787 15 47 43 42 41 39 38 14 34 42 33 86775 24 37 36 12 14 28 47 43 34 27 45 41 1...
result:
ok 3000 lines
Test #6:
score: 7
Accepted
time: 919ms
memory: 48924kb
input:
30000 30000 30000 15802 26734 1581 27129 4313 12830 7001 28197 5489 10268 11838 19275 11260 21410 3519 29279 932 23073 8888 28355 17227 29224 1060 5702 20326 25420 1598 14082 15716 27167 4982 19730 4497 8783 15068 19181 7588 9083 4816 21808 15694 24819 4716 27198 14003 15119 5397 11717 3612 20613 24...
output:
24 115 79 159 99 71 180 64 116 142 81 167 114 82 77 198 78 113 174 176 56 201 118 96 94 101 68 230 86 143 87 114 130 176 157 148 28 33 32 118 122 158 109 111 95 94 71 193 64 80 105 104 91 71 66 84 99 106 71 63 79 110 91 156 160 170 109 104 71 90 157 52 164 119 74 64 147 34 52 30 0 100 24 92 64 119 6...
result:
ok 30000 lines
Test #7:
score: 7
Accepted
time: 158ms
memory: 49744kb
input:
50000 49999 125 274 4495 31902 38170 22094 45892 23403 29854 4496 14675 6736 31591 19339 49660 36467 46207 33868 48663 14410 45594 9616 33814 2297 31602 18150 27372 14438 41157 43354 46408 5615 13800 22514 23053 22773 49388 19461 38226 5507 7948 11643 24820 11391 38028 7115 37842 9224 12555 13589 48...
output:
4319 150 1049596 3018 1051387 6808 1048715 1051913 2625 11955 6901 1052632 1900 3878 1049818 1022 12158 1047204 6442 5902 1047367 1049174 6510 9229 6254 1049925 5769 9246 1051028 10434 5546 10747 1049879 3140 10567 5573 4000 1047848 11408 11383 1811 8147 4195 8949 6004 1050586 11951 7123 3888 3658 2...
result:
ok 50000 lines
Test #8:
score: 7
Accepted
time: 165ms
memory: 49312kb
input:
50000 49999 2 26543 34943 12250 26278 6204 24347 36237 39171 11034 49123 7144 33180 2990 25335 2251 39474 31973 45365 33351 34163 10927 47972 3664 14721 4199 43871 27639 42806 10237 16625 1778 45127 10244 19433 35019 48812 20255 21208 5313 29153 26739 37090 11449 15687 44991 45942 4554 30455 28860 3...
output:
382 7478 11481 18981 2544 6193 6969 19085 22018 14003 12388 6715 6439 9079 21756 17912 20366 19619 17354 11694 9872 9970 6126 1758 16802 1706 3430 4090 1718 11345 7684 1093 17573 9008 21625 15160 2181 8417 18895 5862 5353 9266 539 2926 11278 10332 20648 21133 1616 4111 11289 15144 17751 4278 16583 5...
result:
ok 50000 lines
Test #9:
score: 7
Accepted
time: 2025ms
memory: 49756kb
input:
49900 50000 42252 31673 34001 3171 49595 37687 48457 25040 31103 4835 47250 25324 40443 21968 40072 23116 45237 17324 31804 3492 39449 22950 37705 3268 26931 18426 38071 4309 20249 11732 38687 11281 24273 4078 5861 1111 2202 36679 39285 7779 49424 17122 41344 18695 19877 16943 36716 17973 48599 2340...
output:
35 53 59 57 59 43 48 53 63 35 32 40 43 41 49 60 67 41 28 48 51 35 43 45 50 39 37 48 61 50 20 44 40 18 39 69 37 39 60 43 27 57 61 35 60 35 59 53 62 60 37 37 40 67 59 61 47 37 65 42 33 65 59 22 47 59 52 52 56 46 68 43 45 73 68 53 45 56 38 34 58 51 58 27 70 57 48 52 35 3 41 21 23 65 42 66 39 49 38 37 6...
result:
ok 49900 lines
Test #10:
score: 7
Accepted
time: 475ms
memory: 49416kb
input:
49900 50000 5 27459 48437 7929 27017 37487 44710 6742 37163 1466 26241 37028 46027 8725 25977 27311 38528 2073 22610 6200 42391 2111 49644 5027 26543 19340 26981 1900 30112 24856 34930 21509 40917 16323 31092 5914 6994 8846 27989 24402 49150 14333 22317 5397 26426 38190 44980 25447 46186 34073 34733...
output:
60 79 48 83 23 78 38 21 71 76 62 76 53 78 62 75 65 73 80 85 88 55 83 72 53 71 78 52 45 63 67 66 75 83 59 59 72 71 42 59 67 64 79 70 73 64 55 75 91 59 66 63 72 69 69 41 77 77 61 68 85 65 84 92 74 47 72 78 89 70 27 88 66 97 68 64 64 59 73 80 72 72 80 67 84 86 48 32 51 59 65 67 14 46 61 61 68 50 86 113...
result:
ok 49900 lines
Test #11:
score: 7
Accepted
time: 159ms
memory: 48880kb
input:
40000 50000 17 3772 28831 3207 27926 16079 20924 1192 20502 4781 22932 2594 4155 6997 20560 29715 38517 16722 39329 1924 21420 23245 34020 10419 18358 27722 27895 16776 32777 27098 34509 2147 36642 6928 22403 11448 21432 14401 36406 5641 8940 11162 22282 8438 38945 13165 19750 4425 36476 9297 24093 ...
output:
3554 1115 523 2944 924 9641 622 5662 2133 8243 1589 3860 8598 9890 8224 717 2726 9149 4097 6536 7566 9219 7143 2894 8978 5611 3848 10088 2698 7656 37 1513 2518 8251 7272 7181 2505 5610 4512 5823 4456 1859 9464 7417 3349 7836 3371 3126 7945 2993 468 3666 7114 3469 5122 5241 6861 4635 10151 7798 4115 ...
result:
ok 40000 lines
Test #12:
score: 7
Accepted
time: 157ms
memory: 49104kb
input:
46732 50000 3 31430 36048 6394 23372 4223 14840 18813 32745 29061 44578 24517 31662 8035 10739 19529 43305 27761 32068 21642 35005 29410 35312 29206 34828 13301 40481 196 26877 5085 26629 5908 31213 28930 44249 30083 39590 4027 28399 348 614 9122 32468 17946 32689 3819 20872 7880 15272 13151 40160 1...
output:
7275 10341 3887 11838 2071 2170 10735 4863 7128 11457 8853 11476 4319 7779 534 4989 7668 577 4441 3542 5979 10977 10798 11562 12796 7918 3748 1869 6102 4342 5062 2595 6833 382 14247 3232 7447 8454 676 4147 2530 12869 8086 13135 1287 13189 9696 14600 13163 5143 4909 6999 3997 6043 962 11680 8044 9146...
result:
ok 46732 lines
Subtask #3:
score: 7
Accepted
Test #13:
score: 7
Accepted
time: 23ms
memory: 48224kb
input:
3000 3000 3000 997 1695 884 1068 654 1853 6 520 947 2382 787 2407 818 1795 2347 2718 46 1560 1180 2169 582 1881 1080 1766 770 2877 365 419 365 749 1315 2536 223 1867 216 545 1311 1952 1598 2796 141 620 1681 2938 301 2204 866 1710 872 961 369 466 2160 2936 2295 2359 1310 1744 1572 2088 1111 2618 1680...
output:
357 518 350 113 154 370 718 974 1389 588 1322 215 670 9 870 488 375 195 1102 149 1373 944 303 508 1217 19 920 646 699 713 1152 1247 555 751 80 50 584 1361 149 921 140 1183 989 667 455 198 180 813 472 71 112 169 331 600 666 31 860 145 1090 207 496 654 825 1330 278 112 690 1152 885 1412 94 96 771 132 ...
result:
ok 3000 lines
Test #14:
score: 7
Accepted
time: 915ms
memory: 49416kb
input:
30000 30000 30000 5947 19048 4004 18741 10068 24221 13216 23775 14185 17633 2653 21744 87 19566 5657 19635 24673 28265 5039 14021 8019 20341 7620 25285 6719 8806 15262 25748 14231 28690 21585 29569 27254 27866 12665 29102 2884 11669 2014 11831 1927 26375 9676 21506 2114 28403 18249 27263 4937 8497 6...
output:
85 57 80 39 77 77 60 56 36 92 75 63 85 80 77 67 16 70 86 82 70 63 80 58 64 54 64 29 20 26 67 74 88 18 86 99 47 60 82 100 67 32 58 59 77 69 61 30 59 61 65 58 49 17 64 24 36 63 88 57 53 78 100 107 63 58 69 66 78 81 1 79 71 48 75 57 18 75 72 82 18 71 47 57 80 45 40 71 17 86 82 72 69 73 82 10 40 75 30 1...
result:
ok 30000 lines
Test #15:
score: 7
Accepted
time: 477ms
memory: 49384kb
input:
50000 49999 441 13752 26461 12830 19173 15097 24108 15105 23445 30568 37149 29121 37388 16853 36388 2332 23106 13884 16343 21870 29420 34697 37322 4611 28878 24104 32433 845 2981 23606 39164 10978 27227 23850 45495 28376 45550 14768 19049 36431 48725 37372 44220 4070 7856 37328 38334 22032 37320 277...
output:
147 109 95 133 85 88 117 115 123 128 118 123 83 105 164 166 47 129 107 57 140 19 92 110 108 121 105 66 107 134 122 39 181 55 91 111 185 149 124 81 96 103 86 137 140 155 99 38 68 118 115 66 102 117 159 203 106 83 144 66 85 103 91 91 78 116 85 111 77 20 90 93 103 87 96 116 72 92 77 140 99 92 46 148 10...
result:
ok 50000 lines
Test #16:
score: 7
Accepted
time: 231ms
memory: 49300kb
input:
50000 49999 1819 2471 2577 9290 38110 20086 47735 9982 19388 24362 37153 24480 24904 35405 40183 10359 24769 18437 22809 36558 41038 12004 42490 14824 43127 2373 47513 13223 23738 2786 21378 18137 39439 9235 40939 11462 25171 28454 42312 7133 12894 3114 41608 15664 21152 1949 30132 27893 49158 15965...
output:
10950620 10951788 10948431 7511 2833 9182 2804 10940177 10944504 10944435 3926 10950515 112 10954024 5774 10938948 10942067 10946790 10944859 1336 10952497 7584 10949791 3377 4760 6474 4125 10953956 10942091 10946179 4328 10949418 10945573 10954282 9627 10946781 10945779 10952220 10949123 10945136 1...
result:
ok 50000 lines
Test #17:
score: 7
Accepted
time: 1488ms
memory: 49760kb
input:
50000 49999 35662 26955 36218 13581 14751 24850 29443 8711 12867 2113 39368 11006 18517 27547 49796 32613 38992 736 18363 5915 21396 5976 36537 3332 10378 23828 34508 22434 25441 7039 17333 19565 36142 22079 46132 35400 48037 25620 49983 12577 37381 812 26330 44631 47109 2196 40280 34341 41961 44405...
output:
8842 197696834 197683700 197692919 197691587 3499 197693861 197698070 1657 197697926 197682957 197685669 197696670 833 197691313 5918 197696261 197689530 197697179 197682596 197698239 197692955 197690668 1488 197693440 197682331 197688325 197684863 197686521 197688065 3444 1141 197693436 197690221 1...
result:
ok 50000 lines
Test #18:
score: 7
Accepted
time: 435ms
memory: 49416kb
input:
50000 49999 3 27544 39695 1727 13261 36916 47489 133 35716 1572 16526 294 23844 25944 30678 27331 32683 1665 48942 24907 42045 12297 43901 14231 26892 13329 35892 37419 42213 26243 32826 4989 34909 38725 39667 8824 19308 27956 30610 46104 49848 18530 40063 1464 15635 11932 22836 8616 22371 1035 4056...
output:
77 130 116 174 162 145 204 156 128 134 58 187 107 219 119 150 224 154 147 143 67 167 159 222 217 172 206 140 174 168 190 157 168 155 137 203 89 89 217 173 121 160 117 116 153 203 239 166 129 149 219 148 134 203 144 81 216 203 214 144 96 56 146 168 198 74 146 149 158 148 164 203 105 196 132 204 137 1...
result:
ok 50000 lines
Test #19:
score: 7
Accepted
time: 463ms
memory: 49612kb
input:
49900 50000 14 41964 44331 13443 42333 12584 20671 19574 34793 6894 12858 12691 27150 44610 44715 4224 38194 7501 32051 8972 45912 7732 42068 7894 13851 16234 40002 25095 42385 14616 40804 11411 19931 4165 18064 40764 44230 6450 21888 13938 44908 38295 43370 18578 39073 6445 25729 252 9463 9443 4637...
output:
58 64 57 58 57 51 49 71 70 61 43 54 78 51 20 54 76 33 56 67 66 78 41 43 41 13 31 30 74 52 45 49 67 50 68 69 42 50 42 37 31 72 57 71 47 67 56 59 65 52 52 74 54 65 66 48 59 55 61 56 61 45 46 82 31 46 57 23 61 43 64 47 19 63 75 37 69 33 57 83 70 34 57 49 72 42 52 59 61 72 48 58 43 62 62 54 50 30 53 66 ...
result:
ok 49900 lines
Test #20:
score: 7
Accepted
time: 1413ms
memory: 49712kb
input:
49900 50000 33833 466 31724 2149 2400 18808 43566 22463 25268 20029 22550 2926 36949 636 37271 36418 40182 4792 29770 29446 42808 4942 40003 8697 48739 10008 15875 4438 5839 996 9051 35956 48843 674 28966 8213 39747 29648 46265 29046 30440 5654 40057 1673 47256 32866 38436 5336 41720 17762 38323 316...
output:
159677292 159671932 2160 159666381 159674687 159663698 8105 159675700 6213 159672636 159675843 159674981 159675699 159664031 159665896 159674000 866 7360 159675846 159673232 159674259 159671817 1264 148 159668209 1398 159674937 159673557 159666978 2589 159672832 8269 159673787 3927 159671856 1575 20...
result:
ok 49900 lines
Test #21:
score: 7
Accepted
time: 228ms
memory: 48556kb
input:
10000 50000 8648 6340 7527 138 2772 5690 9264 1603 5328 8582 8948 3180 9235 1862 9332 4000 6468 494 4206 3292 9424 7934 8594 5246 9983 7961 9638 5857 6471 4389 8304 2096 5484 1493 3363 2584 9711 5483 6819 2416 7069 674 6191 1845 2190 3109 8571 3399 8305 4208 5776 1150 7253 4262 9573 6600 6842 1569 9...
output:
4 4 3 4 5 4 5 5 5 4 4 4 3 5 4 4 4 4 4 3 4 4 5 4 5 4 4 3 4 4 4 4 5 5 4 4 5 5 4 5 3 4 4 4 5 4 4 5 4 3 4 5 4 3 3 4 4 4 5 4 4 4 4 3 3 4 4 3 3 4 3 4 3 4 4 3 4 4 4 4 4 5 4 5 4 4 4 4 4 5 4 4 4 4 4 4 5 3 3 4 4 4 3 5 3 4 4 4 3 3 2 3 5 4 5 5 5 3 5 4 3 4 4 5 4 4 5 4 4 3 4 5 4 4 4 4 4 4 4 3 5 5 4 3 4 3 4 4 5 2 ...
result:
ok 10000 lines
Test #22:
score: 7
Accepted
time: 160ms
memory: 48412kb
input:
10000 50000 2 3513 6248 3726 6687 674 6785 1305 9942 2227 8671 3511 7167 2173 9164 1485 1875 2074 5522 529 9104 6605 8331 1794 8490 5655 7413 7500 9009 1513 8563 1118 9881 4823 8914 1273 8122 1014 2961 5750 9452 4717 7762 5219 5611 5734 6904 3236 4657 5396 8631 4887 5072 4318 8863 1632 9086 3888 530...
output:
5 4 4 5 4 4 5 4 4 5 5 3 5 4 3 5 5 4 5 4 5 5 4 4 4 4 4 4 4 5 4 4 4 4 4 4 4 4 4 4 4 5 4 4 5 5 5 4 4 4 4 5 5 4 3 5 4 4 5 4 4 5 4 4 5 4 5 5 5 4 4 5 4 5 4 5 3 4 4 4 3 4 4 4 6 5 4 4 3 5 4 5 4 3 4 5 5 5 5 5 5 5 5 5 4 5 4 4 4 4 4 5 4 5 4 5 4 5 5 5 4 4 3 4 3 4 5 4 5 4 4 5 5 5 4 3 4 5 5 4 5 4 4 5 3 4 4 5 4 3 ...
result:
ok 10000 lines
Subtask #4:
score: 0
Wrong Answer
Test #23:
score: 19
Accepted
time: 4ms
memory: 47468kb
input:
1500 3000 2 432 1120 324 1221 37 294 50 931 588 1149 178 887 460 517 268 533 649 935 123 1291 642 1025 1145 1489 630 1375 163 1407 842 1004 155 1300 296 1049 380 840 215 1224 283 981 211 1056 75 725 325 1437 591 680 1179 1253 876 1425 382 1230 1065 1436 612 784 121 770 349 633 140 1168 443 1019 103 ...
output:
6 6 7 4 5 5 6 3 5 7 5 6 5 5 5 6 6 6 3 5 5 6 3 6 5 6 3 3 6 6 5 6 4 5 7 6 6 6 5 2 5 5 6 5 4 7 4 4 5 5 5 7 6 5 5 3 6 6 5 5 6 5 6 4 5 6 4 7 3 6 6 4 5 5 4 7 6 6 6 7 5 3 5 6 4 6 4 6 4 6 4 6 5 6 3 4 6 4 5 3 6 5 6 7 4 6 5 6 7 5 4 6 5 5 6 6 6 4 5 5 6 4 4 6 6 6 6 6 6 6 6 5 6 6 5 6 4 6 5 6 6 6 6 5 7 4 6 4 6 5 ...
result:
ok 1500 lines
Test #24:
score: 19
Accepted
time: 10ms
memory: 47212kb
input:
3000 2999 5 1183 2619 603 1077 245 1639 988 1253 70 2760 2292 2975 2483 2998 851 1914 214 968 1902 2025 1636 2835 62 2320 2082 2708 267 1972 613 2739 1273 2062 2173 2928 1028 1532 417 2184 291 899 608 2280 922 1566 670 1218 1023 1213 1193 2777 1142 2410 532 1558 67 1473 1041 1652 146 1877 727 2468 5...
output:
79 79 73 72 58 44 91 58 84 78 57 26 82 33 20 109 42 73 114 63 87 59 75 42 87 117 71 56 97 17 29 87 105 40 107 143 44 41 83 101 22 13 88 97 19 40 71 70 15 113 89 97 64 90 66 112 28 88 126 56 50 17 115 17 69 83 92 23 48 135 50 53 77 71 88 87 93 54 25 15 112 69 73 30 72 66 10 66 88 67 67 90 74 78 75 28...
result:
ok 3000 lines
Test #25:
score: 19
Accepted
time: 12ms
memory: 47884kb
input:
3000 2999 376 1269 2828 540 2100 459 2192 1176 2286 1449 1461 2568 2836 511 1436 1580 2036 1623 1837 554 2879 2222 2286 1316 2997 280 337 870 1575 77 2864 10 1424 588 2960 677 2959 254 548 691 1544 346 1337 591 2329 151 1896 305 2577 742 819 1544 2646 679 2071 219 2786 1732 2454 61 1247 1535 2704 10...
output:
684 874 611 580 355 22 246 797 0 415 770 67087 853 67274 298 68077 884 433 110 68087 67193 293 67294 323 705 221 696 67242 33 62 858 242 58 67176 67031 29 67210 67036 67136 805 267 759 28 239 67064 68055 67036 336 67107 67022 316 442 234 703 766 113 373 184 68070 29 717 59 67128 214 825 409 201 6809...
result:
ok 3000 lines
Test #26:
score: 19
Accepted
time: 15ms
memory: 48124kb
input:
2990 3000 25 926 979 752 2267 861 2664 92 2235 1338 1549 5 1674 394 2828 198 2419 328 1655 2230 2675 1946 2452 1460 2590 306 2972 27 1195 1755 2511 38 1631 1518 1734 2799 2869 54 514 1022 2346 410 845 491 2867 1604 2130 666 1955 817 1398 1738 2230 220 495 595 771 470 2755 413 2945 1437 2785 2545 276...
output:
91 109 165 96 123 129 155 223 166 164 99 195 129 276 192 6 193 256 207 105 322 245 208 268 329 251 246 240 97 223 199 97 159 328 52 61 8 160 221 244 0 216 61 309 190 119 63 276 89 226 255 100 286 12 225 224 303 171 220 107 281 84 195 66 164 93 257 131 250 151 170 248 131 98 131 93 129 7 60 280 275 9...
result:
ok 2990 lines
Test #27:
score: 19
Accepted
time: 9ms
memory: 48168kb
input:
2000 3000 14 1723 1954 51 1183 799 1742 871 1087 676 1997 1886 1899 1513 1564 707 1128 222 1168 482 1740 855 1066 550 794 273 1511 986 1515 424 1672 1610 1621 234 563 693 1022 472 624 959 1123 1145 1588 236 514 731 1361 179 608 174 1607 489 1501 945 1757 681 1911 139 1343 1542 1741 1413 1577 1122 16...
output:
1058 550 906 1731 1423 446 1329 951 1557 599 544 478 271 1549 1360 441 546 473 113 53 303 305 207 183 600 993 1404 1585 1733 1645 1427 1008 824 1552 198 1418 8 1170 957 908 162 866 341 910 737 828 1041 1252 505 1478 450 1157 1633 312 1087 1366 467 1026 273 128 385 613 132 1631 690 822 1244 112 1238 ...
result:
ok 2000 lines
Test #28:
score: 19
Accepted
time: 7ms
memory: 47840kb
input:
2000 3000 10 150 1892 195 1292 917 1351 1099 1320 173 1902 388 1264 478 1558 366 1590 1837 1981 789 1209 879 1066 930 989 658 965 238 1597 1153 1162 1061 1092 13 640 1142 1396 1885 1924 294 1959 612 1557 156 1523 409 852 973 1143 195 1368 12 1152 14 423 735 1259 586 1563 669 1266 608 1971 74 1552 26...
output:
149 350 478 4 461 288 495 454 504 316 487 341 238 517 22 84 58 454 186 201 312 465 229 259 268 283 365 239 308 158 516 47 519 240 75 180 448 30 122 23 94 278 80 463 299 130 306 216 507 339 479 487 56 6 261 239 52 377 8 257 268 81 125 10 18 75 420 24 201 312 366 43 508 131 428 31 510 125 361 233 138 ...
result:
ok 2000 lines
Test #29:
score: 19
Accepted
time: 8ms
memory: 48320kb
input:
1500 3000 2040 408 1258 481 1455 313 691 517 975 167 776 123 500 87 104 88 718 1006 1271 264 995 238 806 153 883 828 1280 550 766 1050 1208 515 1300 714 976 883 1441 812 1248 121 1267 1380 1430 1030 1145 390 895 459 541 743 1034 604 929 1080 1440 920 1002 515 1017 454 980 233 1434 669 1298 859 1077 ...
output:
4 4 5 6 6 6 6 5 7 5 3 6 5 6 4 5 7 6 6 5 5 6 4 8 7 5 6 6 5 4 4 8 6 7 5 5 5 6 5 6 6 4 5 6 5 5 4 5 5 6 7 3 7 6 6 5 5 6 4 5 3 4 6 5 5 6 6 6 5 6 6 6 6 7 6 6 5 6 6 3 4 5 4 6 5 6 6 3 4 7 7 6 6 6 4 5 6 6 4 5 8 5 6 5 6 6 5 5 6 6 5 6 7 4 5 7 6 6 6 5 6 5 6 7 6 6 6 6 7 7 5 6 7 6 7 5 6 4 8 6 7 7 6 6 7 5 4 6 5 7 ...
result:
ok 1500 lines
Test #30:
score: 19
Accepted
time: 10ms
memory: 47588kb
input:
3000 3000 3000 1528 2408 111 2158 441 1045 1694 2126 2919 2988 1756 1793 7 916 474 704 396 1861 716 2441 58 211 664 1295 325 1675 1175 1335 1564 1946 166 1623 1432 2641 129 1407 169 1865 839 2184 696 1366 640 1443 1555 1680 302 2348 1347 2113 2054 2567 2829 2881 1579 2042 298 1123 1303 2476 181 655 ...
output:
81001 138001 72001 105001 129001 93001 120001 165001 141001 135001 147001 63001 138001 60001 108001 159001 144001 60001 111001 63001 150001 138001 78001 144001 132001 138001 69001 60001 75001 66001 183001 48001 165001 75001 162001 138001 90001 84001 87001 99001 108001 171001 165001 84001 135001 4800...
result:
ok 3000 lines
Test #31:
score: 0
Wrong Answer
time: 11ms
memory: 47668kb
input:
2244 3000 2 1428 1429 1943 1946 687 689 913 914 1454 1455 608 609 917 919 2119 2120 423 424 2021 2023 116 120 1246 1249 2042 2043 211 212 1636 1639 327 330 116 117 1637 1638 1965 1966 1873 1875 433 435 1411 1412 631 634 1719 1720 363 364 2114 2115 970 971 665 666 779 780 596 597 1757 1758 993 995 12...
output:
1377 1376 1376 1375 1374 1374 1373 1372 1372 1371 1371 1370 1368 1369 1368 1367 1366 1366 1365 1364 1364 1363 1363 1362 1362 1361 1361 1360 1359 1359 1358 1357 1357 1355 1356 1355 1354 1352 1353 1352 1351 1350 1350 1349 1348 1348 1347 1347 1346 1346 1345 1345 1344 1344 1343 1343 1342 1341 1341 1340 ...
result:
wrong answer 1st lines differ - expected: '1373', found: '1377'
Subtask #5:
score: 0
Wrong Answer
Test #44:
score: 23
Accepted
time: 461ms
memory: 49316kb
input:
50000 49999 2 25634 31370 8027 24849 12312 23307 3731 32856 28725 29829 23424 44542 9950 43281 17138 22049 29393 31047 24061 46387 861 3924 12114 24868 29242 36744 5090 11267 3946 26100 7151 22151 27368 49971 43548 44917 25373 45846 4117 43120 24675 34139 9043 21081 29857 41278 37558 41510 11300 402...
output:
114 120 159 152 68 38 72 118 129 123 155 95 61 164 142 103 72 58 122 97 89 73 64 57 174 59 67 114 111 99 122 60 100 61 20 112 104 103 114 168 113 70 104 93 105 49 118 119 111 177 91 88 87 102 162 146 94 178 108 87 98 130 90 152 41 71 61 145 77 79 94 70 133 80 89 124 122 105 67 38 133 173 118 126 85 ...
result:
ok 50000 lines
Test #45:
score: 23
Accepted
time: 171ms
memory: 49448kb
input:
50000 49999 2 43895 48944 8580 43793 5509 33075 15981 49586 724 31051 32635 49692 4755 18049 14056 49273 29520 41218 6544 23864 43813 44446 9124 23567 7289 30800 4062 49229 35718 49417 2991 12579 4020 36609 33183 42312 2126 12426 1152 49261 33185 37634 42 3540 28164 28325 8375 41142 14587 25165 2779...
output:
22033 26533 379 6609 11251 5059 7698 25028 18355 28058 18344 19986 7376 1693 15178 13059 9315 26184 27508 16488 23505 3264 21131 3137 20079 27632 28801 11775 187 12780 26366 29802 26641 13180 7867 9604 23866 19475 4660 4123 13002 25059 21917 19394 28016 28672 19448 12000 20191 28263 8952 5688 28968 ...
result:
ok 50000 lines
Test #46:
score: 23
Accepted
time: 168ms
memory: 49380kb
input:
49950 50000 2 4566 37999 20188 25612 30193 43510 25668 36562 28256 43823 20772 29329 16661 37612 70 48595 33 17367 25778 37077 4934 34483 11295 15609 7376 41523 7796 45967 26467 42262 36278 46521 25896 30329 4435 24881 15142 33287 11683 35540 18305 23196 2597 34080 2122 49079 19179 35816 18617 48301...
output:
764 8452 8468 7140 7241 8980 2754 12524 1411 13960 6656 4755 4200 9225 3500 14506 1777 5644 12460 5955 2527 5071 3412 4282 738 2690 7192 316 1911 8195 3754 2194 14991 4168 4704 15389 11089 2510 8415 5640 3920 10944 13159 11051 3133 5710 10000 2214 955 7407 2225 10109 9732 4737 9027 11810 1913 10206 ...
result:
ok 49950 lines
Test #47:
score: 23
Accepted
time: 397ms
memory: 49556kb
input:
49900 50000 2 22337 34344 3402 42937 21720 34588 19022 34787 5343 18877 43238 43267 2703 20471 18279 47773 47688 48623 13892 29391 8358 23684 9414 25609 32166 34324 16261 22849 48362 48667 2505 34154 178 31736 22256 30061 20580 23750 5141 42669 22569 47226 12171 17545 3389 44447 27268 44611 20016 49...
output:
70 105 86 76 106 93 93 100 74 102 114 75 102 94 55 141 114 68 79 115 110 111 96 101 82 67 119 157 100 59 76 96 128 123 103 83 89 104 87 81 145 122 91 117 103 100 122 112 110 93 185 114 87 95 92 70 124 111 118 111 67 119 53 122 88 83 88 93 90 66 110 127 81 123 79 73 89 67 92 157 70 153 90 87 154 77 8...
result:
ok 49900 lines
Test #48:
score: 23
Accepted
time: 416ms
memory: 49988kb
input:
49900 50000 2 8945 34436 5791 11132 31531 44584 21729 40859 3593 28551 17705 23650 7484 45899 20901 44241 24239 37340 41319 48171 33711 45870 26192 48145 33147 48485 15401 17979 43789 46041 14128 23036 24414 33691 1261 9507 1602 2275 6929 33729 19562 46463 5863 25796 4545 31674 10670 39250 3973 2931...
output:
86 72 56 43 81 72 68 101 70 71 48 49 41 55 52 41 55 61 55 56 75 65 62 78 54 50 57 87 57 25 68 46 65 80 65 59 55 50 50 67 65 87 52 110 76 40 53 62 56 82 71 81 47 60 90 43 61 55 82 42 80 68 52 75 60 47 43 54 47 49 58 87 68 57 52 13 57 96 69 70 65 60 67 47 77 66 67 81 81 19 67 67 81 82 61 18 69 71 57 7...
result:
ok 49900 lines
Test #49:
score: 23
Accepted
time: 156ms
memory: 49884kb
input:
40000 50000 2 15314 17433 3269 19902 20689 23398 13792 23631 9469 35552 2011 2942 746 10547 2487 34970 10637 38858 13754 29351 4195 37154 9693 21108 16406 18812 16694 18823 18173 21541 5995 30185 27088 27533 1798 8110 5478 23675 21259 34392 17486 32860 1662 11587 13795 17385 23329 39617 5911 29267 3...
output:
2836 7313 9014 3462 7796 277 781 4615 1523 8883 1851 9220 7558 3362 6405 7328 1454 2540 4326 4869 5001 7638 8815 2451 5857 7829 5231 1596 964 8995 7490 5987 3705 8993 5950 2439 3185 3224 3959 471 1979 1740 2697 1244 5464 6605 3670 77 4659 2650 231 2274 780 3113 2665 3346 325 4842 4022 3206 5059 5000...
result:
ok 40000 lines
Test #50:
score: 23
Accepted
time: 167ms
memory: 48508kb
input:
10000 50000 2 4769 8553 3189 3302 5295 5915 3232 8063 2497 2904 6120 9199 5732 5853 5566 7061 3602 3669 2483 2996 3329 9775 4918 5767 4841 9426 707 2875 7974 9037 838 7532 7718 8738 1940 4710 5055 8052 5576 5900 2474 5642 2425 5640 4743 9451 5480 7134 3055 4504 1492 2983 3403 9933 3004 9056 5167 831...
output:
4 4 5 4 4 4 4 5 4 5 5 5 4 5 4 4 5 4 4 4 5 4 4 5 5 4 4 4 4 5 2 4 5 4 5 5 4 5 4 5 3 5 4 5 4 4 5 4 5 4 4 5 5 4 4 4 5 5 4 6 4 4 3 5 5 3 4 4 4 4 5 4 5 5 5 4 5 4 5 4 4 5 3 4 4 5 5 5 5 4 4 4 5 5 5 4 3 4 4 4 4 5 5 5 4 5 4 5 5 5 4 5 5 5 3 5 4 4 5 4 4 4 2 5 4 4 4 5 5 5 4 4 5 4 5 5 5 5 4 4 5 5 4 5 5 4 4 5 4 4 ...
result:
ok 10000 lines
Test #51:
score: 0
Wrong Answer
time: 132ms
memory: 49020kb
input:
22501 29998 2 5690 5692 5827 5829 173 174 8464 8466 18880 18882 22428 22429 9080 9081 22110 22111 22157 22158 16632 16633 5 7 6711 6712 20632 20634 10266 10268 21350 21351 3863 3865 2829 2831 16225 16227 12326 12328 4836 4838 1402 1403 10303 10305 5283 5285 2505 2506 1842 1843 7341 7345 5889 5891 91...
output:
14592 14593 14592 14590 14591 14588 14590 14589 14588 14585 14587 14586 14583 14585 14584 14583 14581 14582 14581 14580 14578 14579 14578 14577 14576 14576 14575 14574 14574 14573 14572 14571 14571 14570 14569 14569 14568 14567 14567 14566 14565 14565 14564 14563 14563 14562 14561 14561 14560 14559 ...
result:
wrong answer 1st lines differ - expected: '14069', found: '14592'
Subtask #6:
score: 0
Skipped
Dependency #5:
0%
Subtask #7:
score: 0
Skipped
Dependency #4:
0%
Subtask #8:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
0%