QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#779483 | #2620. Escaped from NEF | aas | AC ✓ | 164ms | 186440kb | C++14 | 2.5kb | 2024-11-24 19:21:33 | 2024-11-24 19:21:34 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e6+100;
struct aa{
int v,w;
};
int read(){
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
vector<int> g[N];
vector<aa> T[N],E[N];
bool ins[N],vis[N],inq[N];
int dfn[N],low[N],bel[N],siz[N],dcnt,deg[N],stk[N],tp,scnt;
void tarjan(int u){
stk[++tp]=u,ins[u]=1,low[u]=dfn[u]=++dcnt;
for(int i:g[u]){
if(!dfn[i]){
tarjan(i);
low[u]=min(low[u],low[i]);
}
else if(ins[i])low[u]=min(low[u],low[i]);
}
if(low[u]==dfn[u]){
++scnt;
while(ins[u]==1)
bel[stk[tp]]=scnt,++siz[scnt],ins[stk[tp--]]=0;
}
}
aa mka(int x,int y){
aa res;
res.v=x,res.w=y;
return res;
}
int w[N],fa[N];
void work(int x){
inq[x]=vis[x]=1;
for(aa i:T[x]){
if(i.v==fa[x])continue;
if(!vis[i.v]){
fa[i.v]=x,w[i.v]=i.w;work(i.v);
}
else if(inq[i.v]){
vector<aa> mp;
for(int cur=x;cur!=i.v;cur=fa[cur])mp.push_back(mka(cur,w[cur]));
mp.push_back(mka(i.v,i.w));
bool bk=1;
int st=0,en=0;
int si=mp.size();
for(int i=0;i<si;i++){
if(mp[i].w!=mp[(i-1+si)%si].w){
if(mp[i].w==0){
if(st!=0)bk=0;
st=mp[i].v;
}else{
if(en!=0)bk=0;
en=mp[i].v;
}
}
}
//if(bk)cout<<st<<" ff "<<en<<endl;
if(bk&&st&&en)E[st].push_back(mka(en,-1)),++deg[en];
}
}
inq[x]=0;
}
int dp[N],ans;
void solve(){
int n,m;
n=read(),m=read();
scnt=tp=dcnt=0;
for(int i=1;i<=n;++i){
T[i].clear(),E[i].clear(),g[i].clear();
low[i]=dfn[i]=stk[i]=bel[i]=siz[i]=ins[i]=dp[i]=fa[i]=w[i]=deg[i]=inq[i]=vis[i]=0;
}
ans=0;
for(int i=1;i<=m;i++){
int u=read(),v=read();
g[u].push_back(v);
}
for(int i=1;i<=n;i++)if(!dfn[i])tarjan(i);
for(int i=1;i<=n;i++){
for(int j:g[i]){
int x=bel[i],y=bel[j];
if(x==y)continue;
T[x].push_back(mka(y,1));
T[y].push_back(mka(x,0));
E[x].push_back(mka(y,1));
++deg[y];
}
}
work(1);
queue<int>q;
//cout<<scnt<<" hh "<<endl;
for(int i=1;i<=scnt;i++){
if(!deg[i]){
q.push(i);
// cout<<i<<endl;
}
}
for(int i=1;i<=scnt;++i)dp[i]=siz[i];
while(!q.empty()){
int u=q.front();
q.pop();
ans+=dp[u]*siz[u];
// cout<<u<<" g "<<ans<<endl;
for(auto i:E[u]){
// cout<<i.v<<" gg "<<i.w<<endl;
dp[i.v]+=dp[u]*i.w;
if(!--deg[i.v])q.push(i.v);
}
}
printf("%lld\n",ans);
}
signed main(){
int t;
cin>>t;
while(t--)solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 12ms
memory: 94480kb
input:
2 3 3 1 2 1 3 2 3 5 5 1 2 2 3 3 4 4 5 4 2
output:
6 18
result:
ok 2 number(s): "6 18"
Test #2:
score: 0
Accepted
time: 12ms
memory: 93696kb
input:
17 15 18 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 3 2 9 9 10 10 11 11 12 12 13 13 10 2 14 14 9 9 15 15 10 15 14 1 2 2 3 4 2 2 5 6 2 2 7 8 2 2 9 10 2 2 11 12 2 2 13 14 2 2 15 2 1 1 2 2 1 2 1 3 3 1 3 3 2 2 1 4 3 1 2 2 3 2 4 6 5 1 2 2 3 3 4 4 5 4 6 7 6 1 2 2 3 3 4 4 5 4 6 4 7 7 6 1 2 2 3 3 4 4 5 5 6 5 7 8 7 1 2 2...
output:
99 78 3 3 9 9 20 25 27 33 34 104 36 81 57 18 38
result:
ok 17 numbers
Test #3:
score: 0
Accepted
time: 19ms
memory: 95256kb
input:
29637 6 7 6 1 1 2 2 3 3 1 1 4 4 5 5 1 6 7 5 1 1 2 2 3 3 1 1 4 4 6 6 1 6 7 4 1 1 2 2 3 3 1 1 5 5 6 6 1 6 6 4 1 1 2 2 3 3 1 1 5 1 6 6 7 6 1 1 2 2 4 4 1 1 3 3 5 5 1 6 7 5 1 1 2 2 4 4 1 1 3 3 6 6 1 6 7 3 1 1 2 2 4 4 1 1 5 5 6 6 1 6 6 3 1 1 2 2 4 4 1 1 5 1 6 6 7 6 1 1 2 2 5 5 1 1 3 3 4 4 1 6 7 4 1 1 2 2 ...
output:
31 31 31 23 31 31 31 23 31 31 31 23 31 31 31 23 31 23 31 23 31 23 23 23 23 17 31 23 31 23 31 31 25 36 24 24 18 31 23 31 31 31 25 36 24 23 24 18 31 23 31 31 31 25 36 24 24 23 18 36 24 36 24 36 27 24 27 27 18 23 23 24 18 23 24 23 18 24 27 27 18 23 23 18 27 18 18 13 31 23 31 23 31 36 24 31 24 31 23 31 ...
result:
ok 29637 numbers
Test #4:
score: 0
Accepted
time: 26ms
memory: 94780kb
input:
31428 8 10 2 1 1 3 3 6 6 1 1 4 4 7 7 1 1 5 5 8 8 1 8 8 2 1 1 3 6 1 1 4 4 5 5 1 1 7 1 8 8 10 8 2 2 1 1 3 3 2 4 1 1 5 5 4 1 6 6 7 7 1 8 9 6 1 1 2 2 3 3 1 1 4 4 5 5 1 1 7 7 8 8 8 3 1 1 2 2 4 4 1 1 5 6 1 1 7 7 8 8 9 3 1 1 2 2 7 7 1 1 4 4 6 6 1 1 5 7 8 8 9 5 1 1 2 2 8 3 1 1 4 4 7 7 1 1 6 6 3 8 9 2 1 1 3 ...
output:
57 35 57 46 36 45 46 51 45 45 45 29 40 57 45 57 46 46 57 57 51 45 51 57 46 51 38 46 51 38 36 46 46 45 57 45 46 46 45 46 57 34 39 57 51 51 40 36 57 39 45 57 36 28 45 45 46 64 57 64 46 51 44 38 57 35 34 46 45 33 28 39 45 45 51 57 51 51 51 34 45 34 57 39 41 50 42 50 39 51 45 35 45 46 51 44 45 39 34 44 ...
result:
ok 31428 numbers
Test #5:
score: 0
Accepted
time: 13ms
memory: 95352kb
input:
3026 8 9 2 6 6 5 5 4 4 8 8 1 1 7 7 3 3 8 8 5 8 8 2 6 6 4 4 7 7 1 1 8 8 3 3 7 5 8 8 8 2 6 6 4 5 7 7 1 1 8 8 3 3 7 7 6 8 7 2 6 6 5 5 4 3 7 7 1 1 8 6 7 8 8 2 6 6 8 8 1 1 7 7 3 4 5 5 7 7 8 8 9 2 6 6 5 5 7 7 1 1 8 8 7 7 3 4 7 7 6 8 8 2 6 6 5 5 8 8 1 1 7 7 3 4 8 8 6 8 9 2 6 6 4 4 5 5 6 3 8 8 1 1 7 7 5 5 8...
output:
51 39 37 26 35 45 38 50 35 45 38 42 57 38 39 45 37 40 35 45 34 51 39 35 36 51 51 39 57 32 51 51 51 51 39 51 46 51 40 38 33 50 42 33 36 46 46 35 45 31 35 39 40 31 34 36 38 35 31 40 30 33 40 36 38 40 39 42 45 26 41 51 38 45 57 39 39 34 51 46 36 39 32 39 46 57 42 42 31 44 36 35 45 35 36 33 31 45 38 34 ...
result:
ok 3026 numbers
Test #6:
score: 0
Accepted
time: 23ms
memory: 103724kb
input:
49 12 15 4 7 7 3 3 9 9 1 1 2 2 9 9 7 7 8 8 10 10 5 5 6 6 10 10 7 6 11 11 12 12 15 4 3 3 1 1 9 9 11 11 3 3 5 5 7 7 6 6 10 10 2 2 12 12 10 10 7 3 8 8 5 12 15 2 1 1 5 5 3 3 6 6 4 4 11 11 6 6 7 7 10 10 6 1 9 9 8 8 2 3 12 12 5 12 15 3 1 1 9 9 2 2 4 4 11 1 10 10 2 2 12 12 4 6 5 5 7 7 9 9 5 5 8 8 6 12 15 5...
output:
114 94 97 83 81 123 123 133 113 113 94 133 133 123 123 122 122 133 113 109 113 98 94 122 97 113 93 133 64 86 102 180 5050 10000 39007 40401 6137 75548 22577617 18352656 147841 18496 181508 35981 2394757 3781827 2447663 75346 69732483
result:
ok 49 numbers
Test #7:
score: 0
Accepted
time: 18ms
memory: 93704kb
input:
100000 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1...
output:
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
result:
ok 100000 numbers
Test #8:
score: 0
Accepted
time: 157ms
memory: 175144kb
input:
1 249999 249998 10722 129602 129602 6141 6141 156674 156674 213617 213617 205445 205445 245358 245358 142289 142289 191622 191622 220538 220538 240558 240558 197794 197794 206875 206875 246527 246527 197965 197965 167930 167930 127171 127171 50150 50150 249766 249766 131194 131194 210806 210806 1586...
output:
24650505003
result:
ok 1 number(s): "24650505003"
Test #9:
score: 0
Accepted
time: 164ms
memory: 179768kb
input:
1 250000 249999 28538 3889 3889 229686 229686 69377 69377 84609 84609 100573 100573 28025 28025 27778 27778 51570 51570 225926 225926 9723 9723 197203 197203 248476 248476 117095 117095 180228 180228 114553 114553 218489 218489 66491 66491 166436 166436 144568 144568 234041 234041 191514 191514 6353...
output:
31250125000
result:
ok 1 number(s): "31250125000"
Test #10:
score: 0
Accepted
time: 141ms
memory: 184460kb
input:
1 249999 249999 1 205555 205555 187897 187897 13683 13683 58071 58071 169535 169535 170102 170102 221207 221207 490 490 249184 249184 178567 178567 98031 98031 187526 187526 239160 239160 239139 239139 122442 122442 87346 87346 159049 159049 101937 101937 172054 172054 156056 156056 181339 181339 18...
output:
19847845340
result:
ok 1 number(s): "19847845340"
Test #11:
score: 0
Accepted
time: 143ms
memory: 185156kb
input:
1 250000 250000 1 132674 132674 165854 165854 158131 158131 187162 187162 25736 25736 228700 228700 23057 23057 215498 215498 232565 232565 49239 49239 165211 165211 32433 32433 68137 68137 106370 106370 200202 200202 118194 118194 21124 21124 20470 20470 108617 108617 230764 230764 157962 157962 20...
output:
21251125024
result:
ok 1 number(s): "21251125024"
Test #12:
score: 0
Accepted
time: 144ms
memory: 182072kb
input:
1 250000 250001 61707 222348 222348 177896 177896 198804 198804 226481 226481 97337 97337 112039 112039 116650 116650 8125 8125 234919 234919 100073 100073 40005 40005 134710 134710 170412 170412 46337 46337 204329 204329 58806 58806 139188 139188 92851 92851 166290 166290 179329 179329 120710 12071...
output:
31250125010
result:
ok 1 number(s): "31250125010"
Test #13:
score: 0
Accepted
time: 164ms
memory: 185424kb
input:
1 250000 250000 83430 100621 100621 149177 149177 206183 206183 64711 64711 159075 159075 129283 129283 215441 215441 48449 48449 57334 57334 21804 21804 201790 201790 138219 138219 64199 64199 196785 196785 176670 176670 78574 78574 126130 126130 157033 157033 249822 249822 113174 113174 98565 9856...
output:
21247575378
result:
ok 1 number(s): "21247575378"
Test #14:
score: 0
Accepted
time: 162ms
memory: 183488kb
input:
1 250000 250000 47831 96385 96385 201670 201670 48004 96385 235822 235822 69010 69010 78675 78675 248756 248756 182442 182442 152745 152745 67444 67444 198105 198105 224567 224567 76625 76625 1700 1700 146394 146394 116265 116265 136227 136227 66916 66916 152893 152893 144984 144984 247043 247043 96...
output:
18650925025
result:
ok 1 number(s): "18650925025"
Test #15:
score: 0
Accepted
time: 163ms
memory: 185212kb
input:
1 250000 250000 82665 710 710 196028 196028 211919 211919 20498 20498 52392 52392 50537 50537 117382 117382 17545 17545 164995 164995 239342 239342 157750 157750 158636 158636 135384 135384 155018 155018 13794 13794 4172 4172 113676 113676 139183 139183 32205 32205 166239 166239 248572 248572 17514 ...
output:
26650709998
result:
ok 1 number(s): "26650709998"
Test #16:
score: 0
Accepted
time: 153ms
memory: 184252kb
input:
1 249987 249987 6065 169639 169639 232519 232519 35512 35512 65593 146712 56825 56825 184356 184356 153654 153654 211732 211732 34908 34908 203497 203497 148811 148811 217608 217608 37081 37081 178424 178424 105610 105610 161562 161562 175329 175329 11434 11434 8567 8567 237745 237745 115549 115549 ...
output:
5216555009
result:
ok 1 number(s): "5216555009"
Test #17:
score: 0
Accepted
time: 158ms
memory: 186440kb
input:
1 249991 249991 20756 164685 164685 168276 168276 2373 2373 9031 9031 175282 175282 131408 131408 37977 37977 97816 97816 168332 168332 200225 200225 28318 28318 142019 142019 243625 243625 189221 189221 128144 128144 183539 183539 147475 147475 21779 21779 121089 121089 153409 153409 171583 171583 ...
output:
5616555028
result:
ok 1 number(s): "5616555028"
Test #18:
score: 0
Accepted
time: 154ms
memory: 162032kb
input:
1 250000 250000 2 57113 57113 121383 121383 125681 125681 184357 3 140451 140451 229622 229622 120660 120660 192212 192212 244309 7 3570 3570 200210 200210 99412 8 172003 172003 187944 187944 11619 11619 140485 140485 159439 9 99096 99096 94021 94021 223580 223580 183244 10 42524 42524 153324 153324...
output:
1449389
result:
ok 1 number(s): "1449389"
Test #19:
score: 0
Accepted
time: 84ms
memory: 143820kb
input:
1 150000 150000 3 83354 83354 125110 125110 32542 32542 80781 80781 7095 7095 112549 112549 83809 83809 140356 140356 26129 26129 144622 144622 116302 116302 85235 85235 107743 107743 51673 51673 86547 86547 78709 78709 109702 109702 79325 79325 63260 63260 90598 90598 40776 40776 83187 83187 69561 ...
output:
2506457
result:
ok 1 number(s): "2506457"
Test #20:
score: 0
Accepted
time: 131ms
memory: 179464kb
input:
1 247500 247500 5 140433 140433 48804 48804 5854 5854 174482 174482 168510 168510 168748 168748 225644 225644 92763 92763 168255 168255 245659 245659 145213 145213 28648 9 70880 70880 16954 16954 113488 113488 201564 201564 55854 55854 218727 218727 230545 230545 119495 119495 229600 229600 85386 85...
output:
7437037
result:
ok 1 number(s): "7437037"
Test #21:
score: 0
Accepted
time: 96ms
memory: 133548kb
input:
3 156250 156250 2 5824 5824 44917 44917 144945 144945 130264 3 146920 146920 29769 29769 70214 70214 2161 4 71607 71607 38647 38647 37266 37266 35085 6 79448 79448 25050 25050 17445 17445 83139 11 31019 31019 148239 148239 154168 154168 31363 13 19371 19371 39244 39244 27922 27922 10838 16 16723 167...
output:
1044785 4909867 738889443
result:
ok 3 number(s): "1044785 4909867 738889443"
Test #22:
score: 0
Accepted
time: 62ms
memory: 111176kb
input:
5 50000 50000 15763 29870 29870 12133 12133 39626 39626 36043 36043 44987 44987 48358 48358 2914 2914 2606 2606 31350 31350 47506 47506 43402 43402 45454 45454 1263 1263 15570 15570 18906 18906 38252 38252 361 361 37154 37154 5473 5473 10904 10904 20533 20533 14883 14883 27887 27887 43137 43137 9942...
output:
794477223 738912777 246981264 484879971 660761801
result:
ok 5 number(s): "794477223 738912777 246981264 484879971 660761801"
Test #23:
score: 0
Accepted
time: 60ms
memory: 107892kb
input:
5 50000 70000 1 42710 42710 33386 33386 1 2 42932 42932 34727 34727 2 3 32717 32717 36916 36916 995 995 7063 7063 26025 26025 995 995 26522 26522 32866 32866 48382 48382 26522 26522 3812 3812 14392 14392 26522 26522 4799 4799 16166 16166 49909 49909 47736 47736 16166 16166 12892 12892 5921 5921 2874...
output:
550221661 182155777 559432 64620646 117075812
result:
ok 5 number(s): "550221661 182155777 559432 64620646 117075812"
Test #24:
score: 0
Accepted
time: 50ms
memory: 104584kb
input:
4 50000 55000 2 33127 33127 39025 39025 4533 4533 34706 34706 38104 38104 4682 4682 31769 31769 48523 48523 13667 13667 6243 6243 7249 7249 12268 12268 27026 27026 16386 16386 30822 30822 13782 13782 4357 4357 4354 4354 6292 6292 13852 13852 17476 17476 4357 2 30459 30459 5182 5182 21412 21412 33127...
output:
72154700 1003227 592923 759958
result:
ok 4 number(s): "72154700 1003227 592923 759958"
Test #25:
score: 0
Accepted
time: 76ms
memory: 115012kb
input:
3 65535 65534 6 11368 11368 35329 9 25627 25627 61179 61179 2600 2600 24547 24547 60324 60324 61346 11 58658 58658 11873 11873 29937 29937 15194 13 53401 53401 26536 26536 5617 5617 34093 34093 20835 20835 44922 15 10333 10333 50632 16 27166 27166 63834 17 9783 9783 33347 19 459 459 19353 19353 2589...
output:
1011552 7859215 6435329
result:
ok 3 number(s): "1011552 7859215 6435329"
Test #26:
score: 0
Accepted
time: 68ms
memory: 115816kb
input:
4 97656 97655 1 92201 92201 93345 93345 46152 46152 53588 2 72392 72392 91173 3 89827 89827 36801 4 78876 78876 2515 5 96857 96857 51121 6 23318 23318 11474 7 77291 77291 64180 8 80421 80421 32290 9 26592 26592 66817 66817 61107 61107 35458 12 51390 51390 72134 13 79712 79712 15093 15 32171 32171 69...
output:
15900020 2455467 2395927 4294574089
result:
ok 4 number(s): "15900020 2455467 2395927 4294574089"
Test #27:
score: 0
Accepted
time: 70ms
memory: 114444kb
input:
4 98299 131064 1 41745 41745 3319 3319 28915 28915 1 2 23895 23895 85363 85363 86350 86350 25073 25073 79335 79335 8578 8578 93341 93341 23300 23300 79335 79335 12027 12027 86350 86350 92433 92433 46857 46857 3041 3041 48523 48523 10116 10116 81839 81839 38640 38640 48523 48523 59016 59016 81084 810...
output:
9662693401 2875471 25597 2508732217
result:
ok 4 number(s): "9662693401 2875471 25597 2508732217"
Test #28:
score: 0
Accepted
time: 43ms
memory: 135352kb
input:
1 250000 249999 1 137693 137693 2 3 137693 137693 4 5 137693 137693 6 7 137693 137693 8 9 137693 137693 10 11 137693 137693 12 13 137693 137693 14 15 137693 137693 16 17 137693 137693 18 19 137693 137693 20 21 137693 137693 22 23 137693 137693 24 25 137693 137693 26 27 137693 137693 28 29 137693 137...
output:
15625374999
result:
ok 1 number(s): "15625374999"
Test #29:
score: 0
Accepted
time: 79ms
memory: 115120kb
input:
2 99225 99224 20 75683 75683 92964 146 42242 42242 64466 176 26881 26881 59909 280 62743 62743 86103 300 46687 46687 42452 42452 84940 84940 12373 12373 56721 56721 74779 74779 91435 91435 66029 66029 10349 10349 82414 82414 3846 3846 31128 31128 91303 91303 84009 84009 462 462 7755 7755 36616 36616...
output:
2461524658 2477103297
result:
ok 2 number(s): "2461524658 2477103297"
Test #30:
score: 0
Accepted
time: 50ms
memory: 115716kb
input:
2 68148 68147 85 25493 25493 2280 2280 53594 53594 36111 36111 37032 37032 2741 2741 64829 64829 4955 4955 33573 33573 11128 11128 5822 5822 22204 22204 61702 61702 37222 37222 10858 10858 51615 51615 52177 52177 4793 4793 24720 24720 56741 56741 32623 32623 21868 21868 5316 5316 65696 65696 9082 90...
output:
1171855676 2500177137
result:
ok 2 number(s): "1171855676 2500177137"
Test #31:
score: 0
Accepted
time: 69ms
memory: 115636kb
input:
2 99682 99681 205 76116 76116 90760 90760 48005 48005 85828 85828 90106 90106 66748 66748 17930 17930 10591 10591 73474 73474 77869 77869 82690 82690 73436 73436 52192 52192 13679 13679 43244 43244 50665 50665 89610 89610 35070 35070 93890 93890 44619 44619 78080 78080 57984 57984 37219 37219 14627 ...
output:
2498677038 2484207180
result:
ok 2 number(s): "2498677038 2484207180"
Test #32:
score: 0
Accepted
time: 40ms
memory: 114496kb
input:
2 99235 99234 1 71996 71996 80385 2 8800 8800 86018 3 67093 67093 53505 4 37897 37897 1026 5 73989 73989 55297 6 45134 45134 15362 7 69945 69945 41987 8 71727 71727 78851 9 52384 52384 60930 10 73989 73989 53762 11 83080 83080 15874 12 37551 37551 34177 13 42866 42866 67590 14 90911 90911 62977 15 5...
output:
603498192 18370774
result:
ok 2 number(s): "603498192 18370774"
Test #33:
score: 0
Accepted
time: 19ms
memory: 112376kb
input:
1 99534 99534 1 53773 53773 86536 2 15391 15391 41987 3 70086 70086 50696 4 64074 64074 6402 5 98248 98248 67075 6 39020 39020 74244 7 42030 42030 67586 8 66266 66266 11265 9 39086 39086 77186 10 98612 98612 93186 11 15738 15738 88066 12 26709 26709 69121 13 66179 66179 80902 14 89172 89172 25089 15...
output:
12135903
result:
ok 1 number(s): "12135903"
Test #34:
score: 0
Accepted
time: 35ms
memory: 105060kb
input:
2 99856 100172 1 74913 74913 13147 13147 46175 46175 39402 39402 37916 37916 52935 52935 18268 18268 11547 11547 95363 95363 6959 6959 60705 60705 26801 26801 70516 70516 634 634 66524 66524 40043 40043 28150 28150 19836 19836 20906 20906 39248 39248 49886 49886 38937 38937 3959 3959 34489 34489 603...
output:
2568764484 153457873
result:
ok 2 number(s): "2568764484 153457873"
Test #35:
score: 0
Accepted
time: 45ms
memory: 108288kb
input:
2 99540 99855 32 2078 2078 49665 49665 48598 48598 700 700 82848 82848 49585 49585 82409 82409 90844 90844 48092 48092 13944 13944 48401 48401 82543 82543 40972 40972 70491 70491 48934 48934 71054 71054 1517 1517 260 260 7765 7765 91757 91757 57632 57632 52007 52007 76112 76112 95545 95545 7160 7160...
output:
176681279 9783521867
result:
ok 2 number(s): "176681279 9783521867"
Test #36:
score: 0
Accepted
time: 51ms
memory: 115288kb
input:
3 98911 99225 430 51105 51105 1747 1747 16655 16655 5908 5908 71436 71436 26627 26627 62159 62159 50842 50842 74967 74967 49477 49477 96722 96722 75456 75456 89523 89523 8942 8942 66729 66729 54123 54123 90031 90031 3271 3271 14540 14540 70956 70956 25677 25677 48978 48978 68838 68838 24895 24895 34...
output:
7013040261 7057837927 831406924
result:
ok 3 number(s): "7013040261 7057837927 831406924"
Test #37:
score: 0
Accepted
time: 55ms
memory: 111100kb
input:
4 47000 46999 120 15651 15651 24577 157 15651 15651 10242 167 15651 15651 26628 200 15651 15651 45067 283 15651 15651 43021 345 15651 15651 38926 399 15651 15651 40977 440 15651 15651 14354 501 15651 15651 10259 618 15651 15651 30743 628 15651 15651 18460 694 15651 15651 26652 697 15651 15651 30756 ...
output:
1082701399 1129262399 602696398 645779015
result:
ok 4 number(s): "1082701399 1129262399 602696398 645779015"
Test #38:
score: 0
Accepted
time: 80ms
memory: 174536kb
input:
1 250000 374998 125001 125000 125000 124999 124999 124998 124998 124997 124997 124996 124996 124995 124995 124994 124994 124993 124993 249994 249994 124994 124994 249995 249995 124995 124995 249996 249996 124996 124996 249997 249997 124997 124997 249998 249998 124998 124998 249999 249999 124999 1249...
output:
31255431113
result:
ok 1 number(s): "31255431113"
Test #39:
score: 0
Accepted
time: 91ms
memory: 180904kb
input:
1 249999 374997 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 125009 125009 10 10 125010 125010 11 11 125011 125011 12 12 125012 125012 13 13 125013 125013 14 14 125014 125014 15 15 125015 125015 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 125025 125025 26 26 125026 125026 27 27 125027 125027 28...
output:
31259757145
result:
ok 1 number(s): "31259757145"
Test #40:
score: 0
Accepted
time: 68ms
memory: 180620kb
input:
1 249996 374992 124999 124998 124998 124997 124997 124996 124996 124995 124995 124994 124994 124993 124993 249992 249992 124994 124994 249993 249993 124995 124995 249994 249994 124996 124996 249995 249995 124997 124997 249996 249996 124998 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 125009 125009 11 11 ...
output:
31257920983
result:
ok 1 number(s): "31257920983"
Test #41:
score: 0
Accepted
time: 57ms
memory: 121108kb
input:
1 250000 374998 250000 232058 232058 136789 136789 136788 136788 106459 106459 29874 29874 29875 29875 23334 23334 29874 29874 106458 106458 106459 106459 136789 136789 147236 147236 147237 147237 136789 136789 232059 232059 232058 34 35 35 210 210 95201 95201 95200 95200 210 210 328 328 52422 52422...
output:
62499750001
result:
ok 1 number(s): "62499750001"
Test #42:
score: 0
Accepted
time: 46ms
memory: 120832kb
input:
1 250000 374998 250000 229487 229487 98060 98060 67816 67816 123960 123960 123961 123961 67816 67816 34616 34616 7671 7671 18866 18866 18867 18867 7671 7671 1203 1203 1202 1202 311 311 107442 107442 215891 215891 215890 215890 107442 107442 107443 107443 115972 115972 156801 156801 156800 156800 115...
output:
62499750001
result:
ok 1 number(s): "62499750001"
Test #43:
score: 0
Accepted
time: 59ms
memory: 120916kb
input:
1 250000 374998 250000 99257 99257 99256 99256 187863 187863 198791 198791 198790 198790 187863 187863 187862 187862 99256 99256 14203 14203 8295 8295 7203 7203 7202 7202 134120 134120 217368 217368 217369 217369 134120 134120 134121 134121 7202 7202 631 631 7203 7203 8294 8294 8295 8295 14202 14202...
output:
62499750001
result:
ok 1 number(s): "62499750001"
Test #44:
score: 0
Accepted
time: 150ms
memory: 174824kb
input:
1 250000 250004 61147 163484 163484 16383 16383 187039 187039 119392 119392 10681 10681 70299 70299 110076 110076 216490 216490 227383 227383 53337 53337 116031 116031 193245 193245 68398 68398 210450 210450 30171 30171 4250 4250 132947 132947 4762 4762 158544 158544 124375 124375 124522 124522 1991...
output:
4973901424
result:
ok 1 number(s): "4973901424"
Test #45:
score: 0
Accepted
time: 160ms
memory: 173048kb
input:
1 249999 250008 145588 211492 211492 11718 11718 75321 75321 89562 89562 51614 51614 31886 31886 13072 13072 247975 247975 150111 150111 129698 129698 175483 175483 57920 57920 28322 28322 247792 247792 96076 96076 95174 95174 155239 155239 33087 33087 128654 128654 197992 197992 105226 105226 13720...
output:
8991988319
result:
ok 1 number(s): "8991988319"
Test #46:
score: 0
Accepted
time: 118ms
memory: 172896kb
input:
1 250000 250008 22588 70639 70639 173789 173789 26157 26157 228363 228363 183154 183154 62583 62583 220488 220488 143159 143159 225637 225637 120772 120772 119093 119093 79317 79317 99496 99496 80017 80017 136319 136319 132731 132731 70636 70636 201941 201941 183753 183753 6188 6188 81780 81780 1923...
output:
17245131665
result:
ok 1 number(s): "17245131665"
Test #47:
score: 0
Accepted
time: 147ms
memory: 170712kb
input:
1 250000 281250 1 195412 195412 125556 125556 110319 110319 182459 182459 135074 135074 96489 96489 79442 79442 50002 50002 43683 43683 22622 22622 120480 120480 195241 195241 248586 248586 212145 212145 122229 122229 243817 243817 136658 136658 221370 221370 233052 233052 116326 116326 243186 24318...
output:
9157252642
result:
ok 1 number(s): "9157252642"
Test #48:
score: 0
Accepted
time: 31ms
memory: 139848kb
input:
1 250000 250000 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:
62500000000
result:
ok 1 number(s): "62500000000"
Test #49:
score: 0
Accepted
time: 28ms
memory: 95956kb
input:
697 10 9 1 4 4 2 3 10 10 6 6 4 4 5 7 6 6 8 6 9 11 10 1 7 7 3 3 4 4 9 9 5 5 11 11 8 8 10 2 6 6 9 12 11 1 3 3 2 3 12 12 4 4 7 5 10 10 8 8 12 12 9 6 11 11 12 13 12 1 4 4 8 8 2 4 13 13 12 6 7 7 3 3 8 8 9 9 5 5 11 9 10 14 13 2 11 11 3 3 13 4 11 11 5 6 11 11 8 9 11 11 14 14 1 1 10 12 7 7 14 15 14 1 2 2 3 ...
output:
39 58 51 61 64 67 67 88 99 110 106 117 122 116 159 147 195 170 201 213 167 228 214 198 208 295 290 280 254 354 357 311 263 383 321 432 417 441 431 410 536 544 526 521 570 533 536 539 589 443 626 721 632 522 816 702 618 745 739 697 732 835 811 869 996 949 916 678 952 961 721 1298 1092 800 1054 1178 9...
result:
ok 697 numbers
Test #50:
score: 0
Accepted
time: 38ms
memory: 95212kb
input:
291 707 706 2 453 453 274 274 244 3 67 67 673 673 693 693 508 4 600 600 641 5 291 291 386 386 676 676 452 7 107 107 145 145 306 8 253 253 706 10 177 177 487 12 660 660 516 13 107 107 610 610 44 14 565 565 305 15 679 679 499 499 195 195 403 16 600 600 626 626 680 18 332 332 28 28 386 386 360 360 197 ...
output:
18252 13093 34232 10915 20031 38550 8984 24847 30581 34431 11345 22450 37260 33352 33523 15734 32278 15530 33570 32305 11113 9724 23382 17909 11803 13116 25549 22475 11392 9491 17663 26468 10170 16206 11359 10916 20367 19867 43982 20008 15163 26009 16852 30562 14643 32797 42536 37620 37821 22963 278...
result:
ok 291 numbers
Test #51:
score: 0
Accepted
time: 121ms
memory: 141012kb
input:
1 250000 249999 1 155354 155354 148268 148268 145100 145100 152796 11 224317 224317 183251 183251 91637 12 208603 208603 199076 199076 71172 71172 190263 13 169780 169780 169439 14 156786 156786 30753 30753 8598 8598 227313 227313 78534 15 24731 24731 153442 153442 143203 16 136083 136083 48117 4811...
output:
9045174
result:
ok 1 number(s): "9045174"
Test #52:
score: 0
Accepted
time: 110ms
memory: 138572kb
input:
1 250000 249999 1 111790 111790 86630 86630 188171 2 44404 44404 242128 3 144831 144831 162666 162666 49777 5 127723 127723 176323 6 141337 141337 211588 8 185891 185891 136365 136365 50738 9 190727 190727 73492 73492 83333 83333 69889 69889 209335 12 17343 17343 68939 68939 58298 58298 100443 13 19...
output:
68707162
result:
ok 1 number(s): "68707162"
Test #53:
score: 0
Accepted
time: 101ms
memory: 136716kb
input:
1 250000 249999 1 168087 168087 199828 2 242336 242336 103278 103278 184326 184326 175891 4 121792 121792 62082 5 28663 28663 217380 6 39104 39104 143652 7 177346 177346 138887 138887 86802 86802 107675 8 183509 183509 13713 13713 5890 10 226214 226214 56838 56838 232576 11 221273 221273 4164 4164 2...
output:
336549357
result:
ok 1 number(s): "336549357"
Test #54:
score: 0
Accepted
time: 80ms
memory: 140836kb
input:
1 250000 249999 1 86098 86098 192740 2 62354 62354 139265 3 37485 37485 641 4 48727 48727 215428 215428 165507 6 191041 191041 3971 8 117112 117112 176675 10 76314 76314 202052 11 3173 3173 107202 12 31632 31632 150833 13 83789 83789 220535 220535 213508 213508 158669 14 211956 211956 114497 16 2232...
output:
869134935
result:
ok 1 number(s): "869134935"
Test #55:
score: 0
Accepted
time: 88ms
memory: 140904kb
input:
1 250000 249999 1 172040 172040 158019 2 66960 66960 105220 3 44906 44906 145802 145802 160772 160772 207380 4 65993 65993 26113 5 101114 101114 225283 6 76238 76238 143303 7 11172 11172 72964 8 235475 235475 223299 9 162201 162201 182275 10 101114 101114 73732 11 21902 21902 117825 12 175427 175427...
output:
1406974095
result:
ok 1 number(s): "1406974095"
Test #56:
score: 0
Accepted
time: 79ms
memory: 138380kb
input:
1 250000 249999 1 137313 137313 22658 22658 120836 2 28317 28317 224010 224010 94721 94721 33862 3 107221 107221 125956 4 4698 4698 218789 218789 188931 5 89464 89464 114689 8 17825 17825 97284 9 66942 66942 44033 10 62054 62054 222788 11 198127 198127 200616 12 228006 228006 119048 119048 219256 13...
output:
2630216200
result:
ok 1 number(s): "2630216200"
Test #57:
score: 0
Accepted
time: 63ms
memory: 138020kb
input:
1 250000 249999 1 82668 82668 195588 2 151659 151659 245764 245764 101957 3 126085 126085 108547 4 98906 98906 203907 5 122417 122417 1537 6 91464 91464 237060 7 198573 198573 98307 98307 138165 8 125427 125427 20482 9 229860 229860 82947 10 151659 151659 135172 11 16861 16861 44993 12 6116 6116 132...
output:
3597960958
result:
ok 1 number(s): "3597960958"
Test #58:
score: 0
Accepted
time: 55ms
memory: 137168kb
input:
1 250000 249999 1 100994 100994 32774 32774 72036 2 103042 103042 30850 3 109649 109649 233476 4 206263 206263 49156 5 142411 142411 147459 6 177839 177839 180227 7 229384 229384 172033 8 62977 62977 171011 9 97921 97921 2689 10 95732 95732 159747 11 53137 53137 136195 12 205560 205560 157697 13 224...
output:
3148507433
result:
ok 1 number(s): "3148507433"
Test #59:
score: 0
Accepted
time: 49ms
memory: 134816kb
input:
1 250000 249999 1 121772 121772 204804 2 246 246 32771 3 246259 246259 135171 4 118139 118139 95745 5 229092 229092 130052 6 151292 151292 22530 7 186689 186689 163844 8 208958 208958 38401 9 237007 237007 196612 10 186689 186689 32777 11 69306 69306 240641 12 193381 193381 113258 13 237007 237007 6...
output:
4989453848
result:
ok 1 number(s): "4989453848"