QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#419872 | #8591. Shops | Faisal-Saqib# | 55 | 797ms | 85040kb | C++17 | 2.9kb | 2024-05-24 12:10:35 | 2024-05-24 12:10:38 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=5e5+10;
const int P=17;
int dist[P][P],dp[N];
vector<pair<int,int>> ma[N];
bool vis[N];
char ans1[N];
bool cal[N];
void dfs(int x,char c='B')
{
vis[x]=1;
ans1[x]=c;
if(c=='B')
c='D';
else
c='B';
for(auto [y,w]:ma[x])
{
if(!vis[y])
{
dfs(y,c);
}
}
}
void compute(int n)
{
for(int st=1;st<=n;st++)
{
for(int ot=1;ot<=n;ot++)
dist[st][ot]=1e11;
dist[st][st]=0;
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
pq.push({0,st});
while(pq.size())
{
auto it=pq.top();
pq.pop();
if(dist[st][it.second]==it.first)
{
for(auto [nxt,wei]:ma[it.second])
{
if(dist[st][nxt]>(wei+it.first))
{
dist[st][nxt]=wei+it.first;
pq.push({dist[st][nxt],nxt});
}
}
}
}
}
}
void dfs_(int x){
cal[x]=1;
for(auto [y,w]:ma[x])
{
if(!cal[y])
dfs_(y);
if(ans1[x]!=ans1[y])
{
dp[x]=min(dp[x],w);
}
else{
dp[x]=min(dp[x],dp[y]+w);
}
}
}
signed main()
{
srand(time(0));
int n,m;
cin>>n>>m;
for(int j=0;j<m;j++)
{
int x,y,c;
cin>>x>>y>>c;
ma[x].push_back({y,c});
ma[y].push_back({x,c});
}
int seed=time(0);
for(int i=1;i<=n;i++)
shuffle (begin(ma[i]),end(ma[i]), std::default_random_engine(seed));
// if(n<=16)
// {
// compute(n);
// // full brute forcess
// int val=1e11;
// string an="";
// for(int mask=0;mask<(1<<n);mask++)
// {
// string ans;
// for(int l=0;l<n;l++)
// {
// if(mask&(1<<l))
// {
// ans+="B";
// }
// else{
// ans+="D";
// }
// }
// int cur=0;
// for(int st=1;st<=n;st++)
// {
// int D=1e11,B=1e11;
// for(int ot=1;ot<=n;ot++)
// {
// if(ans[ot-1]=='B')
// {
// B=min(B,dist[st][ot]);
// }
// else
// {
// D=min(D,dist[st][ot]);
// }
// }
// cur=max(cur,max(B,D));
// }
// if(cur<val)
// {
// val=cur;
// an=ans;
// }
// }
// cout<<val<<endl;
// cout<<an<<endl;
// }
// else
// {
/*
Lets think about DP
mb the dp is like this dp[i][2] = in the subtree of i
*/
dfs(1);
int ans=0;
for(int v=1;v<=n;v++)
dp[v]=1e11;
dfs_(1);
for(int v=1;v<=n;v++)
ans=max(ans,dp[v]);
int val=ans,val1;
string ap,ap1;
for(int j=1;j<=n;j++)
ap+=ans1[j];
int cp=5;
for(int asp=1;asp<=n;asp++)
{
// if(ans1[v]=='D')
// {
for(int v=1;v<=n;v++)
{
vis[v]=0;
dp[v]=1e11;
}
dfs(asp);
ans=0;
dfs_(asp);
for(int v=1;v<=n;v++)
ans=max(ans,dp[v]);
val1=ans;
ap1="";
for(int j=1;j<=n;j++)
ap1+=ans1[j];
cp--;
if(cp==0){
break;
}
if(val1<val)
{
val=val1;
ap=ap1;
}
// }
}
cout<<val<<endl;
cout<<ap<<endl;
// }
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 7
Accepted
time: 2ms
memory: 18132kb
input:
3 3 1 2 3 2 3 1 1 3 2
output:
2 BBD
result:
ok inconveniences = 2
Test #2:
score: 0
Accepted
time: 4ms
memory: 17928kb
input:
5 6 3 2 3 4 2 1 5 3 9 1 3 5 1 4 2 2 3 1
output:
9 BBDDB
result:
ok inconveniences = 9
Test #3:
score: -7
Wrong Answer
time: 56ms
memory: 20516kb
input:
8 135737 1 4 763713071 3 7 45141437 4 8 618418466 6 8 91803956 7 5 972595945 5 2 751163228 2 8 9886315 4 3 106470622 8 6 949495949 1 2 885918825 4 6 322040168 7 6 754489330 4 8 618968328 5 3 996860159 3 6 210132897 3 4 591744987 8 7 447985622 2 4 4833956 5 7 610154418 2 5 410116873 2 5 912717336 8 7...
output:
61947 BDDBDDBB
result:
wrong answer your claimed answer is 61947, but the inconveniences of your plan is actually 20770
Subtask #2:
score: 13
Accepted
Test #11:
score: 13
Accepted
time: 417ms
memory: 84896kb
input:
500000 499999 1 2 776715136 2 3 406881694 3 4 265792290 4 5 507607272 5 6 182246639 6 7 997847597 7 8 164130256 8 9 278962226 9 10 411194641 10 11 363646402 11 12 672225656 12 13 494629089 13 14 717664153 14 15 121619271 15 16 476857704 16 17 301215244 17 18 810217743 18 19 850722975 19 20 10710274 ...
output:
998789691 BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD...
result:
ok inconveniences = 998789691
Test #12:
score: 0
Accepted
time: 413ms
memory: 84884kb
input:
500000 499999 1 2 919029898 2 3 967926553 3 4 537841283 4 5 789574589 5 6 84356111 6 7 262979300 7 8 81760204 8 9 934833222 9 10 815362560 10 11 765318578 11 12 133878729 12 13 42184040 13 14 683417496 14 15 330426787 15 16 252037344 16 17 246808442 17 18 218647305 18 19 390164712 19 20 304437162 20...
output:
998086576 BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD...
result:
ok inconveniences = 998086576
Test #13:
score: 0
Accepted
time: 415ms
memory: 85040kb
input:
500000 499999 1 2 495717169 2 3 2736566 3 4 246490731 4 5 676348793 5 6 433656165 6 7 300871636 7 8 877832205 8 9 24348676 9 10 904055276 10 11 110426018 11 12 943185526 12 13 820883221 13 14 622560418 14 15 960692040 15 16 630347197 16 17 390849180 17 18 366668667 18 19 919683360 19 20 161247567 20...
output:
999027362 BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD...
result:
ok inconveniences = 999027362
Test #14:
score: 0
Accepted
time: 444ms
memory: 85036kb
input:
500000 499999 1 2 881926628 2 3 878365295 3 4 189444416 4 5 196764012 5 6 937066345 6 7 492929211 7 8 404162136 8 9 294189704 9 10 648590434 10 11 205708308 11 12 917107337 12 13 430038581 13 14 988914191 14 15 996853504 15 16 766772044 16 17 551967939 17 18 98588609 18 19 726003769 19 20 770678124 ...
output:
998870338 BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD...
result:
ok inconveniences = 998870338
Test #15:
score: 0
Accepted
time: 428ms
memory: 85040kb
input:
500000 499999 1 2 275555710 2 3 928907994 3 4 351852867 4 5 739735339 5 6 757618705 6 7 186440113 7 8 817785536 8 9 958144538 9 10 65474464 10 11 881281553 11 12 537108380 12 13 419150600 13 14 786449308 14 15 645606967 15 16 757995051 16 17 9350371 17 18 413220186 18 19 856401635 19 20 774467299 20...
output:
998341670 BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD...
result:
ok inconveniences = 998341670
Test #16:
score: 0
Accepted
time: 408ms
memory: 84808kb
input:
500000 499999 1 2 2726164 2 3 814453419 3 4 77779202 4 5 212522091 5 6 575026293 6 7 111411302 7 8 671949780 8 9 598712779 9 10 513069672 10 11 622002136 11 12 606394125 12 13 554104755 13 14 693830694 14 15 464592249 15 16 176186577 16 17 170141847 17 18 84481371 18 19 18806105 19 20 887306486 20 2...
output:
998639500 BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD...
result:
ok inconveniences = 998639500
Test #17:
score: 0
Accepted
time: 411ms
memory: 85040kb
input:
500000 499999 1 2 699534547 2 3 756875816 3 4 650330256 4 5 385184303 5 6 252347359 6 7 572617046 7 8 54010889 8 9 947248022 9 10 691017140 10 11 281775875 11 12 804678960 12 13 796483137 13 14 721881104 14 15 799196727 15 16 932579324 16 17 778572034 17 18 156714181 18 19 173646893 19 20 854532026 ...
output:
998386205 BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD...
result:
ok inconveniences = 998386205
Test #18:
score: 0
Accepted
time: 426ms
memory: 85040kb
input:
500000 499999 1 2 528281229 2 3 544813983 3 4 970327172 4 5 223929886 5 6 297537831 6 7 701582097 7 8 321477324 8 9 508501108 9 10 187475004 10 11 847549963 11 12 25037993 12 13 730505330 13 14 934227167 14 15 42350450 15 16 716244922 16 17 577182613 17 18 47412695 18 19 403130619 19 20 783335054 20...
output:
998268275 BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD...
result:
ok inconveniences = 998268275
Test #19:
score: 0
Accepted
time: 422ms
memory: 84808kb
input:
500000 499999 1 2 176647181 2 3 430435019 3 4 142683460 4 5 760806099 5 6 691983032 6 7 640928945 7 8 564806640 8 9 587621269 9 10 656576849 10 11 810001387 11 12 295415472 12 13 676473367 13 14 495893801 14 15 236356194 15 16 896384046 16 17 853257263 17 18 531811298 18 19 914837617 19 20 540207783...
output:
998100668 BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD...
result:
ok inconveniences = 998100668
Test #20:
score: 0
Accepted
time: 385ms
memory: 84912kb
input:
500000 499999 1 2 459441093 2 3 712179264 3 4 462698877 4 5 428755230 5 6 140982872 6 7 333359430 7 8 145590701 8 9 605794157 9 10 885201977 10 11 992315213 11 12 787968819 12 13 693140189 13 14 777613982 14 15 486848706 15 16 417423069 16 17 904399877 17 18 169733516 18 19 650464517 19 20 956947852...
output:
998576988 BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD...
result:
ok inconveniences = 998576988
Subtask #3:
score: 18
Accepted
Dependency #2:
100%
Accepted
Test #21:
score: 18
Accepted
time: 788ms
memory: 49216kb
input:
500000 499999 1 498191 98644113 4 407741 285960522 9 2593 142219271 10 231716 692978475 11 281544 395541063 12 425498 656170589 13 383980 504747359 19 160252 266870005 21 153907 259282410 23 150872 408664227 24 364918 305130116 29 206272 807953223 32 114552 837969530 33 446658 296132297 34 445587 53...
output:
999999634 BBDBBBBBDBDDDDBDBDBDBDBDDDBDDBBDDBDDDBBDBBBBBBBBBBDDDBBBBDBBDBDBDDDBBDDDDBBBDBDDDBDBDBBBBDBDDDDBDDDBDDDDDBBBBBBDBDDDDBDBBBBBDDDBBDBBBBBDDDBBBBBBDDDBBDDDBBBBBDBBDBBBDDDDDBDBBDDBBDDBDDDBBDDBDDBBBBBDDBDBDBDBBDBBBBBBBDDBBDBDDDBBDBBDBBDDBDBDBDBBDBBDDDDDBDBBDBBDBDBDBDBDBBBBDDDDBDBBDDDDDDDDBDDDDB...
result:
ok inconveniences = 999999634
Test #22:
score: 0
Accepted
time: 776ms
memory: 49228kb
input:
500000 499999 1 298047 486034323 3 302455 15380870 10 112586 384710444 12 461380 106460032 15 400629 477739108 16 122191 944242040 19 140395 876468438 20 474471 54926698 21 247975 99912702 27 311759 304963895 29 201874 604590096 32 50134 964818840 34 52048 182700548 35 250795 19874383 38 296918 1736...
output:
999996272 BDDBBDBDDDBDBBDBDDDDBDBBBDDDBDDBDDBBDBBBDDBDDDBDDDDDDDBBDBDDBDDDDBBBBDBBDDBBBDDBBDBDDBBDBDBDDDBDBBBDBDBBDDBDBDDBDBBBBDBDDBBDBBBBDDDBBDDBDDDDDBBDDBDDBDDDDDBBBBBDDDDDBDBDDBDBBDDDDBBBDDDBBBDDBBDDDBDBDDBBBDBDDBBBDDBDBBBBBBBBDDDBDBDDDDBDBBDBBBDDDBBBDBBDBDBBDBBBBBBDBBBBDBDDDDDDDDDBBBDBDDBDDBDDBD...
result:
ok inconveniences = 999996272
Test #23:
score: 0
Accepted
time: 797ms
memory: 49212kb
input:
500000 499999 2 226958 733592075 3 282387 995489009 5 3289 914063619 7 440129 319619170 10 232251 411769136 15 43628 596243869 16 52374 374810745 24 21798 520964509 34 187883 248720052 35 17991 51962919 37 359348 832609079 42 101340 397779335 43 208881 996145582 44 4415 606734719 45 65727 142440494 ...
output:
999998286 BDBDDBBBBDBBDBDDDDDDBBDDBDBBDDDDBBBBDBDDBDBDDBBDBBBDDDBDDBBBBDBDBBBDDBDBDBBDBDDBDBBBDDBBDBBDDDDBDBBBBBBBDBDDDDBDDBBDDDDBDDBDDDBBBBBBDDDBBDDBDBDDDBBDBDBDDDBDBBBBBDBDDBDDBBDDBDBDDBBDBDDDBBDBBBBBBDBDDDBDDBBDDDBDBDDDBBBDDDBBBBDBDDDDBBBBBBDBDDBBBBBDBDDBBDDBBBBDBDDBBDBDBDBDBDBBDBDBDBDDBBDBBDDBBD...
result:
ok inconveniences = 999998286
Test #24:
score: 0
Accepted
time: 786ms
memory: 49324kb
input:
500000 499999 1 195861 482944530 4 253474 607504910 6 499057 183478116 7 270968 191239 9 218955 878650354 11 395347 639963581 18 131956 561652195 20 83456 418951767 21 52587 414052939 26 293651 163591780 32 174307 880729517 34 443184 781843198 36 99016 683958976 40 405900 433342252 43 379684 4646270...
output:
999999321 BDDBBDDDBBDDDBBDBDDBDBBDDDBDDDBDBBDBBBDBBDDDBBBDDBDDBDBDBDBDBDBBBBBDDBBDDBDBDBBDDBDBBBBDDBBBDBBBBBBDBBDBDBBBDDDBDDBBDDDBBBDBBBDBBDDDDBDBDBDBBDDDBDBDBDBDDDBDBBBBBBBDDBBDDDBDBDBBDBDDBBBBBDBDBDBDDBBBBDDDDBDBBBBBDBBBBDDBBDBBDBBBBBBDBDDBDBDDDBDBBBBBDBDBBBBBBDBDDDDDDBDBDDDBDDDDDBDBDDBDDDDDDDDDDB...
result:
ok inconveniences = 999999321
Test #25:
score: 0
Accepted
time: 765ms
memory: 49396kb
input:
500000 499999 1 393184 586613362 4 340302 191769755 6 454461 697663107 8 116487 763378035 10 311098 323331823 11 271655 814032559 12 449238 759661861 13 489535 331502823 16 25411 976732072 23 180097 559693743 25 25359 850249966 26 352864 542643997 28 16841 296031371 30 472953 998957448 31 128349 210...
output:
999991572 BBDDBDDBBBBDBDDBBBBBDDDBDBBBDDDDDBBBBDBDBDDDBDDDDDBBBDBDDBBDBDBDDBDBBDDDBBDDBBBDDBDBBBBDBDDDBBBBBBBDBDDBBBDDBDBBDDDBDBDBDBDDDBDDBBDDDDBBBDBDBBDBDDDBBDDDDDBBDDDBBDDBBBDBBBBDDBDBBBBDDDDDBBDBBBDBBBBBBDBBBDDBDBDBBDDBBBBBBDBDDDDDBBDBBBBDDBDDBBBDDBDDBDDDBDBDDDDBDBDBBBDBDBBDBBDBBBBBDBDBDBBBBBDDDD...
result:
ok inconveniences = 999991572
Test #26:
score: 0
Accepted
time: 766ms
memory: 49336kb
input:
500000 499999 3 100372 223541239 4 428911 979162540 8 389796 555207091 9 18026 175154280 13 83459 757629595 14 318242 562687038 16 186332 56015539 19 450513 687421132 23 363524 355955464 28 19737 665996432 30 324384 78021621 33 82309 139756751 36 302313 309431714 37 25550 234897335 38 15923 59162388...
output:
999997771 BBDBBBBBDBDBBBDDDDDDDDBDBBDDDBBBBBDDBBBDDDBBDDDBBBBBBDDDDBDBDDDDDDDDBBDDDBBBDBDBBDDBBDBDDBDBDDDDBBDBDDBBBBDBDDDBDBBBDDBBBBDBDBBDDDBBBDDDBBBBBDBDDBDBDDBBBBDBDDDDDBBDDDBDDBDBDDDBBDDDDBDBDDBBBBDDDBBBDDBBBDBDBBDBDBDBDBBBBBBDDBBBDDDDDDDDDDDBBDDBDDBDBBDBBBDDBDDDBBBBBDBBDDBBBDBDDBDDDDBDDDDBBBDDBD...
result:
ok inconveniences = 999997771
Test #27:
score: 0
Accepted
time: 789ms
memory: 49364kb
input:
500000 499999 3 322399 938467174 5 294668 997432634 9 140349 749403173 13 156326 230666059 15 176904 584148575 18 462527 661616347 19 115932 915236576 20 40100 537230519 21 360684 923335513 22 478700 447133025 25 299737 154218322 28 413164 457095459 31 459296 293271135 32 200585 898724710 36 129428 ...
output:
999995080 BBBDBBBBDDDDBBBDBDBDDDDDDDBDBDDDDBBBBBDBDBBBDDDBBBBDDBBDBBDDBBBBBBDBDBBBDBDBBBBDBBBDDDBBBBDDDBDBDBBBBDBDBBBBBDBDBDBDDDDBDBDBBBBDBBBDBBDBBDDBDDBBDDBDBDBBBBBBDBDBBBDBBBDBBBBDDDBDBDDBDBDDBDDBDBBBBBBBBDDDDBBDBDBBDBDDDBDDDBBDDDDDDDBDDBDDBDBBBDDDBDBBBDBDBBBBDDBDBDDBBBBBBDDBBBBBDBBDBDDBBDDBDBBBDB...
result:
ok inconveniences = 999995080
Test #28:
score: 0
Accepted
time: 769ms
memory: 49192kb
input:
500000 499999 1 349448 695258814 3 413276 280795333 5 321286 908037219 13 407009 915549351 17 386773 804890068 21 39914 951119699 22 480150 163314795 25 134419 514390297 27 432990 814259581 29 335885 139743148 35 28324 612519155 36 43885 372504270 42 344828 8498457 48 449031 890534986 51 362532 6223...
output:
999998911 BBBBDBBDBBDBBDBBDBDBBBDDDBBBDBBBDDBBBBDDBDDBDBDDDDDBBDBDDDBBBDDDBBDBBBDBBBDDBBBDBDDDDDDDDDBBBDDBDDDDDBBBBBBDBBDBBBDDBBDDBDBBBBBDDDDDDDBDBDBDBBDDDDDBBBDBDDDBDBDDBDBDBBBDBDBDDBDBDDBBDBBBDBBBDDBBDDDBDBDBDDBBBDDBDBBBDDDBDDBDDBDBDBDDDBDBDBDBBDBBBDDDDBBBBBBBDDDDBBDDBDBBBBBBBDDDBDDDDBBBDBBBBDBBBB...
result:
ok inconveniences = 999998911
Test #29:
score: 0
Accepted
time: 786ms
memory: 49280kb
input:
500000 499999 2 10921 246329059 5 470731 878985801 7 160878 180062960 8 58099 756069772 10 475544 658632747 15 476775 199595606 21 95867 218826447 28 293838 603911187 29 268431 782740038 33 408755 673720382 37 490718 552334523 38 362775 747272214 40 283199 889096173 43 455689 72912274 50 213988 5215...
output:
999996361 BDDBBDDBBDBDBBDDDDBBBDBDBBBBBBBDDDBBBBDBBBBDDDBBBBDBBBBBDBBDDBBDBBBDBDBDBBDBDBBBBDBBBDBBDBDDDDDDDDDBBDBBBBBBBBBBBDDDDBBBBDBBDBBDDBDBBBBBDBDBDDDDDBBDDDBDDBBBDBDDDDDBDDDBDBBDDBDBDDBBDDBDDBBBDBDDBDBBBDDDBBBBBDDDBDBDBDBBBDBBDBDDDBDBDBDBBDDBBBDBBBDBBBBDDBBDDBBDBBBDDBBBDDBBDDBDDDBDBDBBDDDBDDDBDB...
result:
ok inconveniences = 999996361
Test #30:
score: 0
Accepted
time: 762ms
memory: 49204kb
input:
500000 499999 1 143758 557958489 4 395896 134647479 5 223284 982837565 6 152064 270356505 7 49367 458751900 12 408086 415638934 13 281677 430784294 17 199713 516686210 21 126232 368019079 24 121546 763498777 26 261239 623535252 32 460231 602594775 38 405662 735358912 40 122229 589490694 42 253737 23...
output:
999999181 BBDBBDDDBBBBDDDDDBDDDDBBDBDBBBDBBBBDDBDBDBBBBDDDBBBDBDDDBDDBBDDBDBBDDBDBBBBBBDBDBBBDBDDBDDDBDDBBDDBBDDDBDDBDBDDBDBDBDBDDBBBDDBDBBDBDBDBBBBDBDDBDDBDDBDDBBBBBDBBDBDDBBDDDDBDBDBDDDDBDBBDDBDBDDBDDDBDDBBBBBBDBDDBDBBBBDDDDBBBBDDDBDBDBBDDDDBBDBDBDDBDDDDDBDBBDDBBBBBDBDBBBBDDDBDBBDBDDDBDBBDDDDBDDDD...
result:
ok inconveniences = 999999181
Subtask #4:
score: 24
Accepted
Test #31:
score: 24
Accepted
time: 590ms
memory: 48536kb
input:
366489 397001 2 127909 1 7 171229 1 8 158597 1 11 282213 1 14 356007 1 15 286102 1 16 93205 1 17 260111 1 18 138962 1 20 359938 1 29 223905 1 31 357684 1 32 259968 1 34 65205 1 37 200276 1 41 83195 1 43 159858 1 48 332277 1 50 320322 1 51 338467 1 53 262785 1 55 83815 1 56 173198 1 58 169473 1 63 19...
output:
1 BBDDDDDBDDDDBBBBDBDBBBDBDBDDDBDBDDBDDBDDBBBDDDBDDDDBDBBDBBBDBDDBBBDDDDDDBDDDBDDDDBDBBBBDDDDDDDBBBBDDDBBBBBDDDBBDDBBDBDDDDBDBDBDDBBBDBDBBDBBDDDDDBBBDDBDDDBDDDDDDBBDDBDDBDDBBBDDDBBDDBDBBBDDDBBDDDBDBDDDBDDBDBDDBBDDDBDDDDBBBDBBBBDBDBDBBDBBBBBBBDBBDDDDBBDDBBDDBDDDBBDDBDBBBDDDDBDBDBDDDBDBBDDBDDBBDDBDBBD...
result:
ok inconveniences = 1
Test #32:
score: 0
Accepted
time: 726ms
memory: 53348kb
input:
475552 488952 2 161263 1 3 312211 1 5 41910 1 6 421865 1 7 340911 1 9 419906 1 10 468773 1 13 17837 1 18 465833 1 19 297766 1 21 234125 1 26 218984 1 28 296050 1 29 411520 1 30 38207 1 33 370786 1 34 21620 1 35 467168 1 40 136766 1 42 353240 1 44 194443 1 46 119022 1 48 23233 1 54 380603 1 60 99339 ...
output:
1 BDBDBBDBBDBBBDDBDDDDDBBDBBBBDBBBDDDBDDBDDBBDBBDBBDDDBDDBDDBDBBDBDBBDBBDBDDBDDBDBBDDBBBDBBBBDBDBDDDBDBDDDDBDBBDBBBDBDDBDBDDBBDBDDBBBBBBDBDDDBDBBBDDBBDDBBDBDDBDBDDDDBBDDBBDBBDDBBBBBBDDBDDDBBBDBBDDDDDBBBBDBBBBBBDBDBBBBBDBDBBBDDDDBBDBDBDBBBDBDBBBBBDDDBBDDDBDBDDDBBBBBBBDDDBBDDDBBBDBBBDDBDBBBBDBDDDDDDBB...
result:
ok inconveniences = 1
Test #33:
score: 0
Accepted
time: 165ms
memory: 28664kb
input:
128817 140020 2 53427 1 5 86824 1 6 33490 1 11 63864 1 14 109608 1 15 12909 1 16 45790 1 19 27271 1 22 54044 1 24 11063 1 32 53692 1 35 70034 1 38 84224 1 39 64068 1 43 72895 1 44 51948 1 45 40428 1 49 127824 1 50 52852 1 60 25795 1 61 105666 1 65 41013 1 67 97450 1 69 49349 1 71 47569 1 72 70751 1 ...
output:
1 BDBDDDDBBDDDBDDBDDDDBBBBBDDBDDBDDDBDBDDBBBBBBDDBDDDBDDDDBBDDBBDBDDBDDDDDBBDBBDBDBDBBDBBDDDBBDDDBBBBBDDDBDBBDBBBBDBDDBBDBBBDDDBBDBDBDBBDDDBBBDDBDBBDDDDBDBDDBDBBBDDDDBBDBDBDBBDDDBDBBBDBBDDDDBDBDBDBBBDDDDBDBBDDBBBDBDBBBDBDBDDDBBBBBBDDDDDDDBBDDBDBBDBBDDDDDDBDBBBDDBBBBBBBDDBBDBDDDBBDDDBBDBDBDBBBBBDDDDD...
result:
ok inconveniences = 1
Test #34:
score: 0
Accepted
time: 469ms
memory: 43616kb
input:
299635 331829 5 197808 1 11 67054 1 12 84275 1 15 287112 1 16 274955 1 24 40825 1 30 266299 1 34 81379 1 35 99815 1 38 219853 1 42 189961 1 47 107895 1 48 137516 1 50 80614 1 54 264232 1 55 93625 1 62 143056 1 63 70844 1 64 72811 1 65 164091 1 68 248158 1 70 9821 1 72 156352 1 77 215022 1 81 270025 ...
output:
1 BDDDDBDBDBBBDDDBBBBBBDBBDBDBBBDBBBDDDBBBBDDDBDBDBBDDBDBBDDBDDDDBBBDDBBDDBBDBBBDDBDBDBBBBDBDDDBBBBDBDBBDBDDDBDBBBDBBDDDDBBBDDDDBBDDBBDDDBBBDBDBDDBDBDDDBBDDDBDDBBBBDBDDBBDBDBDBBBDBDBDBBBBDDDDDDBBBBDBBDBDDBBDBBBDBDBBBBBDBBDDDDBDDBBBBDBBBDBBDDBBBBDDDDBDDBDDBBBDBBDBDDBBDBDDDDBBBBDDBDBBDBDBDDBBBDBDDDBBD...
result:
ok inconveniences = 1
Test #35:
score: 0
Accepted
time: 689ms
memory: 55072kb
input:
369927 447544 1 150509 1 5 250257 1 6 149327 1 7 201307 1 15 330381 1 16 158914 1 18 99391 1 24 90164 1 25 199087 1 28 306199 1 32 83429 1 35 212184 1 36 29977 1 37 261629 1 44 99341 1 45 48378 1 51 130523 1 53 148929 1 58 77382 1 71 211093 1 72 305907 1 73 227420 1 75 188876 1 76 71437 1 79 354402 ...
output:
1 BDDBDBDDDBDDDDBBBDBBBDDDBBDBDDDDBBDDDDBDDDBDDBDBBDDDDBBDBDBBBDDDDBBDBDDDDDBDDBDDDDBDDBBBDBBBDBBDBDDDDBBDDBDBBDDBDDBBBDBBDDBBDBBBBBDBBBBBDDBDBBBBDDDBDBBDBDBDBBDBDDDDDDBBDBDDDBBBDBBDBDBDDBDBBDDDDDBBDDBDDBBDBBDDDDDBDDDBBBBBDDBBDDBDBDBBBBBDBBDBBDDDDDDDBBDDBBDDBDBBBDBBDBBBDDBBDDBDDBDBDDDDBDBBBBDDDBBBBB...
result:
ok inconveniences = 1
Test #36:
score: 0
Accepted
time: 710ms
memory: 49328kb
input:
500000 500000 4 319400 1 12 186157 1 13 443669 1 15 227339 1 19 101284 1 20 183604 1 23 273179 1 26 236933 1 27 79090 1 28 826 1 29 7574 1 31 370188 1 32 48463 1 34 113530 1 35 209157 1 46 13739 1 47 188127 1 48 97203 1 51 251724 1 52 469749 1 53 451782 1 56 249224 1 58 262324 1 60 380990 1 61 82320...
output:
1 BBBBBBBDBBBBBBBDBDDDBBDDBBBDBDBBDDDDBBBBDBBBDDDBDBBDDBDDBDBDBBBDDDBDBDDBBDBDBDDBDDBDDBDDDBDBBBBBBBDBDDBBDBBDBBDBDDBBBBBDBDBDDDBBBDDBDBDDDBDDBBBBBDDBDBDDBDDBDBBBDDDDBBBBBBBDDBDDDDDBDBBBDDBBDDDBBBDDBDBBBBDDBBDDBDBBDBDBBBDBDDBDDDBBDBDDDBDDDDBDDBBDDBBBBBDBBBDBDBBBDDDBBBDDBBBBDDBDDBDDDDDBDBDDBBDBBDBDBD...
result:
ok inconveniences = 1
Test #37:
score: 0
Accepted
time: 712ms
memory: 49300kb
input:
500000 500000 2 182927 1 5 313016 1 9 438269 1 10 97892 1 11 373266 1 13 314494 1 14 318813 1 20 102513 1 23 304478 1 24 162451 1 27 207273 1 30 182950 1 34 133161 1 35 62401 1 37 102023 1 38 19183 1 41 96619 1 42 264471 1 45 339682 1 46 60188 1 51 134306 1 53 85702 1 54 170539 1 55 74017 1 73 14900...
output:
1 BDDDBDBDBBDBBBDBDBDDDBBBBDBBDBDDBDDDBBBBBDBBBBBDBDDDBBBBDBDDDBBDBBDBBBDBBDDDBDBBDBBDBBBDDBDBBDBBDDDDDDDDDDDDDDBDBBBDBBDDBBBDBDBDDDBBDBBDDDDDBBBDDDBDDBBBDDBDDBBDBDBBDBBBDDDDBDDDBDDDDBBBDBDBBDBBDBDBDBBBBBDDDDDDDDBDBDDDBDBDDDBBBBDBDBBBBBBBDDBDBBBBDBBBBDBBDDDDDDDDBDDBBBDDBDBDBBDBDBBBDDBDBDDDDBBDBDBDDD...
result:
ok inconveniences = 1
Test #38:
score: 0
Accepted
time: 668ms
memory: 49244kb
input:
500000 500000 4 490349 1 5 377743 1 7 261998 1 14 410844 1 17 106150 1 20 477772 1 22 48037 1 24 388329 1 26 328805 1 28 248860 1 30 216330 1 34 479575 1 37 303722 1 38 392533 1 40 191119 1 42 177919 1 44 322555 1 45 306160 1 50 129452 1 51 215260 1 53 146880 1 56 441549 1 64 249852 1 69 422318 1 70...
output:
1 BDBDBBBDDBBBDDBDDDBDDBBBDBDDBBDBBDDBDDBDBBBDBBBBBDBBBBDBBBDBDBBBDBDBDDDDDBBBDDBDBBDBBDBBDDBDDDBDDDDBDBDBDBDDBDDBDDDBBDBDBDDBDDDDDBDDDDBBBBBBBDDDDDBBDDDDDDBDBBBDDDDDDBBDDDDDDDBBBBBDBDBDBBBBBBDDDBBDBBDDDDDDBDBDDDDDDDBBDBDDDDDDDBBBDDBBBBBDBDDDBDDDBDDBDDBDDBBDBDBBDDBDBDBDBBBDDBBBBDBDDDBDDDDDDBDDDDBDDB...
result:
ok inconveniences = 1
Test #39:
score: 0
Accepted
time: 701ms
memory: 49320kb
input:
500000 500000 9 213713 1 13 307012 1 14 327287 1 16 103990 1 23 409412 1 24 80587 1 25 91210 1 26 413674 1 28 167751 1 29 223056 1 31 395367 1 34 70127 1 38 344870 1 39 499865 1 40 91257 1 41 443805 1 43 109678 1 47 387825 1 49 328529 1 53 186674 1 59 197682 1 60 27560 1 61 402852 1 64 380750 1 66 1...
output:
1 BDDDDBBDDDBBDBBDDBBDDDDBDBBBBDBDBBBBDBDBBBDBDBBDDBDDBDBBDBDBBDDBDDDDDBDBDBDBBBBDBDDDBBDDBBBDDBDBBDDDDDBDDBBDDBBDDDDBDDBDBBDBDDBDDBBDDBBBBBDBDBBDBBDBBBDDBDBBBBDDDBDDDDBDDDBBDBDDBBDDDDDBDBDDDDDBBDBDDBBDDDDBBDDDDDDDDDBBBBBBDBDDDBDBBDBDDBBBBBBBBDBBDBBBDDDBDDDBDDDBBBBBBBDBDBBBDDDBBDBDDDDBDBDDDDBDDDBDBD...
result:
ok inconveniences = 1
Test #40:
score: 0
Accepted
time: 703ms
memory: 49296kb
input:
500000 500000 1 420147 1 2 70976 1 5 354943 1 6 261427 1 9 317379 1 11 31032 1 15 419781 1 16 155356 1 19 459807 1 25 72438 1 28 385731 1 30 19123 1 34 18208 1 35 332853 1 39 338723 1 41 356728 1 42 114047 1 44 389270 1 47 112208 1 48 23788 1 52 312381 1 57 317756 1 60 311741 1 61 218196 1 62 182171...
output:
1 BBBBDDDDDDBDBDBBBBDDBDBBBDDDBBDBDBBBBDDBDDDDDBDBDBDDBBBBDDBBDDDDDBDDDDBDDBBDBBBBDDDBBBDDDBBBBDBBBBBDBBDBBDBBBBDDDBDBDDDBBBDBDBDBDBDDDBDBDBDBDDDDDDDBBBBDDDBDDBBDBDDBDDBDBDDBDBDBDBBBBBBDBBBBBDDBBBBBBBDDDBDDDDDBBDDBBBDBBBDBBDDDBDBBBBDBDDBBBDBBBDBDDBBDDBDDBBDBBDDDBBDDBBDDDBBDBBDDDBBBBDBDBDBDDBBBDDDDBD...
result:
ok inconveniences = 1
Subtask #5:
score: 0
Skipped
Dependency #1:
0%