QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#413473 | #8671. 分流器 | ANIG | 97 | 11ms | 4764kb | C++23 | 1.6kb | 2024-05-17 16:43:30 | 2024-05-22 20:19:11 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned short
const int N=5e4+5;
int n,to[N][2],dp[N],rd[N];
ull f[N];
ull pows(int a,int b){
if(b==0)return 1;
ull res=pows(a,b>>1);
res=res*res;
if(b&1)res=res*a;
return res;
}
deque<int>q;
int lcm(int a,int b){
if(!a||!b)return a|b;
return a*b/__gcd(a,b);
}
signed main(){
cin.tie(nullptr),cout.tie(nullptr)->sync_with_stdio(false);
cin>>n;
for(int i=1;i<=n;i++)cin>>to[i][0]>>to[i][1],rd[to[i][0]]++,rd[to[i][1]]++;
for(int i=1;i<=n;i++){
int op;
cin>>op;
if(op)swap(to[i][0],to[i][1]);
}
q.push_back(1);
dp[1]=1;f[1]=1;
while(q.size()){
int x=q.front();
q.pop_front();
if(f[x]&1)dp[x]++,f[x]<<=1;
int c=to[x][0],k=max(dp[x],dp[c]);
// cout<<x<<" "<<dp[x]<<" "<<f[x]<<endl;
if(dp[c]){
f[c]=f[c]*pows(2,k-dp[c])+(f[x]>>1)*pows(2,k-dp[x]);
}else{
f[c]=(f[x]>>1)*pows(2,k-dp[x]);
}
dp[c]=k;
rd[c]--;
if(!rd[c])q.push_back(c);
c=to[x][1],k=max(dp[x],dp[c]);
if(dp[c]){
f[c]=f[c]*pows(2,k-dp[c])+(f[x]>>1)*pows(2,k-dp[x]);
}else{
f[c]=(f[x]>>1)*pows(2,k-dp[x]);
}
dp[c]=k;
rd[c]--;
if(!rd[c])q.push_back(c);
}
vector<int> ans={1};
int cnt=dp[n+1]-1;
while(cnt--){
for(int i=0; i<ans.size(); i++){
ans[i]=ans[i]*2;
}
for(int i=0; i<ans.size(); i++){
if(i==ans.size()-(int)(1)){
if(ans[i]/10){
ans.emplace_back(0);
}
}
ans[i+1]+=ans[i]/10;
ans[i]%=10;
}
}
reverse(ans.begin(),ans.end());
for(auto p:ans) cout<<p;
cout<<'\n';
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 0ms
memory: 3892kb
input:
5 2 3 4 5 4 5 5 6 6 6 0 0 0 0 0
output:
8
result:
ok single line: '8'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
5 2 3 4 5 4 5 6 6 6 6 0 0 0 0 0
output:
4
result:
ok single line: '4'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
5 2 3 4 5 6 5 5 5 6 6 0 1 0 0 0
output:
8
result:
ok single line: '8'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
5 2 3 4 5 6 6 5 5 6 6 0 0 1 1 1
output:
8
result:
ok single line: '8'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
5 2 3 4 5 6 6 5 5 6 6 0 0 0 1 0
output:
8
result:
ok single line: '8'
Subtask #2:
score: 15
Accepted
Dependency #1:
100%
Accepted
Test #6:
score: 15
Accepted
time: 0ms
memory: 3884kb
input:
20 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 12 19 21 21 15 16 18 18 21 21 19 21 18 21 21 19 20 20 21 21 1 0 0 1 0 0 1 1 1 0 0 1 1 0 0 1 1 0 0 1
output:
128
result:
ok single line: '128'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
20 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 19 15 21 21 21 20 21 19 21 17 21 20 18 21 20 20 21 21 21 21 1 0 1 1 1 1 0 0 0 1 1 1 1 1 0 1 0 0 1 0
output:
128
result:
ok single line: '128'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
20 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 21 16 19 13 19 17 20 17 17 20 21 21 20 18 19 21 20 21 21 21 1 0 0 0 1 1 1 1 1 0 0 1 0 1 0 0 1 0 1 0
output:
512
result:
ok single line: '512'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
20 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 21 18 18 21 19 15 21 20 21 17 20 21 18 19 21 21 20 21 21 21 1 1 1 0 1 0 0 1 0 1 0 1 1 1 1 1 1 0 1 0
output:
256
result:
ok single line: '256'
Subtask #3:
score: 15
Accepted
Test #10:
score: 15
Accepted
time: 8ms
memory: 4604kb
input:
50000 2 3 4 5 50001 6 7 8 9 10 11 50001 12 13 14 15 50001 50001 50001 50001 16 50001 50001 50001 17 18 19 20 50001 21 50001 22 50001 50001 23 50001 24 25 26 27 28 29 30 31 50001 50001 32 33 34 50001 50001 35 36 37 38 50001 50001 39 50001 50001 40 41 50001 50001 42 50001 50001 50001 50001 43 50001 44...
output:
8589934592
result:
ok single line: '8589934592'
Test #11:
score: 0
Accepted
time: 5ms
memory: 4604kb
input:
50000 2 3 50001 4 50001 50001 5 50001 6 7 50001 8 9 10 11 12 13 14 15 16 17 18 50001 19 20 21 22 23 50001 24 50001 50001 50001 25 50001 26 50001 27 28 50001 29 30 31 50001 50001 32 33 34 50001 50001 35 36 50001 37 50001 38 39 50001 40 41 42 43 50001 44 45 50001 46 47 48 50001 50001 49 50 50001 51 52...
output:
34359738368
result:
ok single line: '34359738368'
Test #12:
score: 0
Accepted
time: 3ms
memory: 4508kb
input:
50000 2 3 4 5 50001 6 50001 50001 50001 50001 7 8 9 50001 10 11 12 50001 13 50001 50001 14 15 16 17 50001 18 19 50001 20 21 22 23 24 25 26 27 28 29 30 50001 50001 50001 31 50001 32 33 34 50001 50001 50001 35 50001 36 37 38 39 40 41 42 50001 43 44 45 46 50001 47 50001 50001 50001 50001 48 50001 49 50...
output:
8589934592
result:
ok single line: '8589934592'
Subtask #4:
score: 20
Accepted
Dependency #2:
100%
Accepted
Test #13:
score: 20
Accepted
time: 0ms
memory: 3888kb
input:
100 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 25 29 30 31 21 32 33 34 19 35 34 36 37 38 39 40 41 42 43 44 45 46 47 48 101 49 44 50 51 51 50 51 52 53 54 55 56 57 58 47 59 60 37 59 101 61 62 46 63 64 65 66 67 101 54 68 69 58 101 70 101 71 72 73 101 101 74 65 75 76 101 77...
output:
32768
result:
ok single line: '32768'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
100 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 34 35 36 37 36 22 38 39 39 40 41 42 43 31 44 45 46 47 48 30 49 50 51 52 53 49 101 54 55 56 57 58 59 60 46 58 61 62 101 47 42 101 63 61 61 64 65 51 66 67 68 47 69 70 71 72 73 101 74 75 76 77 78 79 80 101 60...
output:
32768
result:
ok single line: '32768'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
100 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 101 30 23 31 32 33 34 35 36 37 38 101 39 40 41 42 43 44 45 46 47 48 49 43 30 34 50 51 46 52 53 54 55 56 101 57 58 44 59 39 42 60 42 61 49 62 63 64 65 66 41 57 54 67 68 69 70 71 51 72 73 57 56 101 57 74 75 76 77 101 78 10...
output:
65536
result:
ok single line: '65536'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
100 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 101 34 35 36 37 38 39 40 41 42 43 44 45 26 46 47 48 27 49 50 51 33 52 53 52 54 55 56 56 34 57 57 58 59 101 60 61 39 62 63 64 55 65 66 67 68 101 69 50 58 70 71 72 101 73 74 75 76 77 78 79 80 81 54 82 83 69 84 ...
output:
4096
result:
ok single line: '4096'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
100 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 26 32 33 34 101 35 36 22 37 38 29 29 39 40 41 42 43 44 36 41 36 45 46 47 48 49 50 51 101 52 53 54 55 56 46 50 41 57 43 58 59 60 44 61 62 63 64 65 60 66 67 64 68 47 69 50 70 71 72 73 74 75 76 74 77 78 79 80 81 101 8...
output:
16384
result:
ok single line: '16384'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
100 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 18 30 31 32 33 34 101 35 36 37 38 30 39 29 40 26 41 42 43 44 45 46 101 47 40 48 42 44 49 47 50 51 52 49 53 53 54 39 42 46 45 55 42 49 55 56 57 56 58 59 45 60 61 62 63 64 65 101 57 66 67 68 69 70 71 72 73 74 75 69 76 77 7...
output:
2048
result:
ok single line: '2048'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
100 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 101 26 27 28 29 30 18 31 32 33 34 101 20 35 36 37 38 39 40 41 42 43 44 45 46 47 48 44 49 50 31 51 52 101 53 54 101 55 101 49 50 56 57 58 59 60 61 101 43 62 63 52 64 65 66 53 67 101 68 66 69 70 101 71 72 73 62 74 75 76 77 59 74 50 61...
output:
32768
result:
ok single line: '32768'
Subtask #5:
score: 20
Accepted
Dependency #4:
100%
Accepted
Test #20:
score: 20
Accepted
time: 1ms
memory: 3928kb
input:
2000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2001 28 29 23 30 31 32 33 34 35 36 37 28 38 37 39 40 41 42 40 43 44 45 46 2001 37 47 48 49 50 51 52 32 53 54 55 56 2001 57 58 59 60 61 62 63 56 64 2001 65 60 64 51 66 2001 67 68 48 69 70 71 51 2001 72 51 60 73 74 75 57 76 77 ...
output:
20282409603651670423947251286016
result:
ok single line: '20282409603651670423947251286016'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
2000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 20 23 24 25 26 27 28 29 24 30 21 31 32 33 34 35 30 36 26 37 25 38 39 29 40 41 42 43 44 45 46 47 40 2001 48 49 50 51 52 53 54 55 56 57 2001 2001 36 58 2001 2001 59 60 2001 61 62 2001 63 61 2001 64 2001 52 65 50 58 66 67 68 69 61 59 70 2001 7...
output:
2596148429267413814265248164610048
result:
ok single line: '2596148429267413814265248164610048'
Test #22:
score: 0
Accepted
time: 1ms
memory: 3704kb
input:
2000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 18 2001 30 31 32 33 34 2001 35 36 37 2001 38 39 37 40 41 42 43 44 45 2001 46 47 48 49 2001 50 51 52 53 54 2001 2001 2001 55 56 49 44 36 57 58 59 60 38 61 62 63 2001 64 65 66 43 45 54 67 2001 68 69 70 71 72 73 63 74 75 7...
output:
1267650600228229401496703205376
result:
ok single line: '1267650600228229401496703205376'
Test #23:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
2000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 31 37 38 39 40 36 41 42 43 28 24 35 44 45 46 47 48 49 50 51 46 52 37 43 39 53 2001 54 55 56 57 58 35 59 60 61 55 62 2001 63 64 42 41 65 51 66 67 66 68 69 55 70 71 72 73 2001 74 75 58 65 55 70 76 77 ...
output:
2535301200456458802993406410752
result:
ok single line: '2535301200456458802993406410752'
Test #24:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
2000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 2001 31 38 39 40 41 29 42 43 44 45 46 47 48 49 50 50 51 44 52 53 54 55 2001 53 38 56 57 58 59 60 61 45 62 2001 63 64 65 2001 50 2001 66 67 68 69 70 63 71 48 52 72 63 62 73 74 75 76 77 51 53 78 79...
output:
9903520314283042199192993792
result:
ok single line: '9903520314283042199192993792'
Test #25:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
2000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2001 26 27 28 29 30 2001 23 31 32 33 34 35 33 36 37 38 39 40 41 41 2001 42 43 34 29 44 45 46 47 32 48 41 2001 49 50 51 52 53 42 2001 35 41 2001 2001 42 54 55 56 57 58 59 43 50 60 61 2001 62 63 61 58 64 65 66 67 46 47 68 69 58 53 70...
output:
2596148429267413814265248164610048
result:
ok single line: '2596148429267413814265248164610048'
Test #26:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
2000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 23 28 29 30 2001 31 32 24 33 2001 25 33 32 34 35 36 37 38 39 2001 40 41 42 29 43 44 45 46 47 48 49 50 51 39 36 52 53 54 55 56 57 49 2001 2001 58 59 60 61 62 63 2001 64 56 65 66 2001 67 2001 68 69 2001 70 71 72 59 73 74 75 76 ...
output:
2535301200456458802993406410752
result:
ok single line: '2535301200456458802993406410752'
Test #27:
score: 0
Accepted
time: 1ms
memory: 3704kb
input:
2000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 30 32 33 21 25 20 34 35 36 37 38 39 40 2001 41 42 43 44 45 2001 46 47 48 49 50 35 51 44 52 53 54 55 56 57 58 59 60 61 62 60 63 64 65 47 66 67 68 69 70 71 72 2001 64 73 74 52 54 56 75 76 61 77 73 50 78 79 54 80 81 ...
output:
162259276829213363391578010288128
result:
ok single line: '162259276829213363391578010288128'
Test #28:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
2000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 13 25 26 2001 27 28 29 30 27 31 32 23 33 34 35 36 37 38 39 40 41 42 43 44 2001 45 46 47 48 49 50 51 52 53 2001 54 49 55 56 57 58 59 60 61 35 53 62 2001 63 56 59 64 2001 65 56 66 67 68 69 55 54 70 71 2001 49 72 2001 73 74 75 2001 76 77...
output:
81129638414606681695789005144064
result:
ok single line: '81129638414606681695789005144064'
Subtask #6:
score: 20
Accepted
Test #29:
score: 20
Accepted
time: 8ms
memory: 4460kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 50001 45 46 47 48 49 50001 40 50 51 40 52 53 54 55 56 57 58 59 60 61 57 39 62 63 64 65 66 67 50001 68 69 54 50001 70 71 72 73 74 75 76 77 47 77 73 78 79 52 76 80 68 81 82 83...
output:
317624883870373507138831797099734055743873969948324731607638926709094484242961434875861799369272588648755542418038360833477281684824324490604855548268961204923221725750403452934972636403246568312773419816518854101919362705918837856047439617445015267692027248697240015519360857697395495747870630856046...
result:
ok single line: '317624883870373507138831797099...3514898281882163107621939183616'
Test #30:
score: 0
Accepted
time: 8ms
memory: 4756kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 36 36 53 54 55 56 51 57 58 59 60 61 62 63 41 57 64 65 50001 66 67 68 69 56 70 57 71 72 73 74 75 76 77 78 79 80 81 72 82 83 68 84 85 74 86 87 88 89 90...
output:
416317287786575963277009613094563421544610489890668192212764494016144322386934411920489577669292967393696864558171240311655342649932938596325596264227092830516965180375568813830927333986463342018918376821907592448467747085901939154678500055377530411669293955412446433141536663401130224186648993275636...
result:
ok single line: '416317287786575963277009613094...4747602858882842222812674916352'
Test #31:
score: 0
Accepted
time: 8ms
memory: 4560kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 50001 46 47 48 49 50 51 52 53 54 50001 55 51 56 57 39 58 59 37 60 61 62 63 64 50001 59 65 66 67 47 46 48 68 43 42 69 70 71 72 73 74 50001 50001 75 76 77 78 50001 79 80 81...
output:
266443064183408616497286152380520589788550713530027643016169276170332366327638023629113329708347499131965993317229593799459419295957080701648381609105339411530857715440364040851793493751336538892107761166020859167019358134977241058994240035441619463468348131463965717210583464576723343479455355696407...
result:
ok single line: '266443064183408616497286152380...3846582968501902260011194646528'
Test #32:
score: 0
Accepted
time: 8ms
memory: 4764kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 41 55 56 57 38 35 50001 58 59 60 50001 61 62 63 64 65 48 66 67 64 50001 68 69 70 52 71 72 73 74 75 76 77 78 79 80 81 82 83 50001 50001 84 85 86...
output:
248144440523729302452212341484167231049901539022128696568467911491480065814813620996767030757244209881840267514092469401154126316269003508285043397085125941346266973242502697605447372190036381494354234231655354767124502113999092075037062201128918177884396288044718762124500670076090231053023930356286...
result:
ok single line: '248144440523729302452212341484...6902460142827204399278296399872'
Test #33:
score: 0
Accepted
time: 9ms
memory: 4408kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 36 62 63 53 64 65 64 39 66 67 68 69 70 71 72 66 73 74 67 75 50001 76 77 78 79 80 50001 81 82 83 61 79 84 50001 85 86 87 88...
output:
416317287786575963277009613094563421544610489890668192212764494016144322386934411920489577669292967393696864558171240311655342649932938596325596264227092830516965180375568813830927333986463342018918376821907592448467747085901939154678500055377530411669293955412446433141536663401130224186648993275636...
result:
ok single line: '416317287786575963277009613094...4747602858882842222812674916352'
Test #34:
score: 0
Accepted
time: 9ms
memory: 4496kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 38 49 50 51 52 53 54 55 56 57 58 31 59 60 61 62 63 64 58 65 66 67 68 69 70 71 72 73 74 42 75 76 77 78 79 74 80 81 50001 82 83 84 46 62 85 86 87 50001 50001 88 51...
output:
208158643893287981638504806547281710772305244945334096106382247008072161193467205960244788834646483696848432279085620155827671324966469298162798132113546415258482590187784406915463666993231671009459188410953796224233873542950969577339250027688765205834646977706223216570768331700565112093324496637818...
result:
ok single line: '208158643893287981638504806547...2373801429441421111406337458176'
Test #35:
score: 0
Accepted
time: 8ms
memory: 4760kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 39 47 48 49 50 51 32 52 53 50001 54 55 56 57 58 59 60 50001 61 62 63 64 65 66 67 68 69 67 70 50001 71 72 73 71 74 75 50001 76 50001 77 50001 78 79 80 73 80 81 82 83 84...
output:
635249767740747014277663594199468111487747939896649463215277853418188968485922869751723598738545177297511084836076721666954563369648648981209711096537922409846443451500806905869945272806493136625546839633037708203838725411837675712094879234890030535384054497394480031038721715394790991495741261712092...
result:
ok single line: '635249767740747014277663594199...7029796563764326215243878367232'
Subtask #7:
score: 5
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Dependency #6:
100%
Accepted
Test #36:
score: 5
Accepted
time: 11ms
memory: 4468kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 50001 29 32 33 34 35 36 50001 37 38 39 40 41 34 42 43 37 44 33 45 46 47 48 49 50 50001 30 33 50001 51 52 53 54 55 56 57 38 44 58 59 60 61 62 63 45 64 47 58 64 65 66 67 62 68 69 61 66 70 71 72 73 47 66 74 57 75 76...
output:
502249939076847322365274589508828161408676805383584178531413871344213148904540016402648876573967425302920188384621103349009310938578719045238648838524146994609246605772593509063470010786259060778882772794968575379291919706534607536480791025304753444288417079647481011580652529533585985746503167431109...
result:
ok single line: '502249939076847322365274589508...2433089638503419886946010267648'
Test #37:
score: 0
Accepted
time: 11ms
memory: 4468kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 50001 28 29 30 31 32 33 34 35 36 37 27 32 38 39 29 40 41 39 39 42 43 44 32 45 31 46 47 48 49 50 51 35 45 40 52 53 54 55 38 56 57 57 45 58 59 60 61 50001 50001 50001 62 63 64 50001 65 64 62 66 53 67 56 68 69 70 71 49 72 73 50...
output:
289527377724588021602357123150282418590960058083626293765705385289932677080643516325642216994253380182979885775971846616918446575219800661475102224197896969663131697846171597400727995473492693499572815618365334444076179253528236422077251239432118057566155567669235987146916164773203170427194170210841...
result:
ok single line: '289527377724588021602357123150...7332018824313811454389569716224'
Test #38:
score: 0
Accepted
time: 11ms
memory: 4764kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 17 27 28 29 30 50001 19 26 30 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50001 49 48 50 43 51 47 52 41 50 53 54 55 39 56 57 48 39 47 58 59 50001 50001 60 40 61 62 63 63 64 47 65 66 50001 50001 67 68 58 69 70 71 60...
output:
168527114277582162526876853750018879416724700762207092348081866098761486984232624716615663488775829425419148625789586580893051912553958048505651662241374706886203318046272963635115881609667961892888890357202230047013249279423754442295322217647986287231414792866699855743742178178627026748840097693517...
result:
ok single line: '168527114277582162526876853750...0825067584363977589197096615936'
Test #39:
score: 0
Accepted
time: 11ms
memory: 4416kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 50001 23 15 24 25 26 27 28 29 30 31 50001 32 33 34 35 36 32 37 38 39 40 41 50001 42 34 43 44 45 38 50001 46 47 48 49 50 51 52 53 46 54 55 56 48 57 58 50001 59 60 37 52 61 62 63 49 64 65 66 47 67 68 69 70 71 44 72 48 73 64 74 75 57 76 63 77...
output:
310877654655936111963866340110776870252988962677858841202348329047835081525773164313268852046813421955838276308403665959098242084923061963168682792796706829170163694797565162410051336787571788368904258262879282104352382706634367011344461614734103167314420879896920877525570318738663718537078327524355...
result:
ok single line: '310877654655936111963866340110...6021047459428349393673520152576'
Test #40:
score: 0
Accepted
time: 11ms
memory: 4564kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 28 29 24 30 31 31 32 33 30 34 35 50001 33 36 37 38 39 40 41 42 43 44 44 45 46 47 50001 48 41 49 50 39 51 52 47 53 40 54 54 37 42 50001 55 37 56 57 58 59 60 50001 51 61 50001 50001 61 62 63 56 64 65 66 63 67 68 69 70 71 72...
output:
269643382844131460043002966000030207066759521219531347756930985758018379174772199546585061582041327080670637801263338529428883060086332877609042659586199531017925308874036741816185410575468739028622224571523568075221198847078007107672515548236778059570263668586719769189987485085803242798144156309628...
result:
ok single line: '269643382844131460043002966000...3201081349823641427153545854976'
Test #41:
score: 0
Accepted
time: 7ms
memory: 4500kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 15 50001 25 26 27 28 29 27 30 31 50001 32 33 34 35 36 37 23 31 38 39 40 41 42 43 50001 44 45 42 46 47 38 46 48 49 50 51 52 36 41 53 54 50001 54 42 55 50001 56 57 42 51 58 59 60 61 62 58 63 64 60 65 66 67 68 45 69 70 51 71 72 73 74 75...
output:
231621902179670417281885698520225934872768046466901035012564308231946141664514813060513773595402704146383908620777477293534757260175840529180081779358317575730505358276937277920582396378794154799658252494692267555260943402822589137661800991545694446052924454135388789717532931818562536341755336168673...
result:
ok single line: '231621902179670417281885698520...8656150594510491635116557729792'
Test #42:
score: 0
Accepted
time: 11ms
memory: 4464kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 25 31 32 50001 29 33 28 34 35 23 36 37 38 39 40 27 41 42 28 36 38 43 44 45 30 46 41 47 48 49 50 35 51 46 46 37 52 53 47 54 55 41 56 50 57 58 59 60 61 62 56 63 50001 44 64 65 57 66 67 68 69 70 71 72 50001 73 74 75 76...
output:
579054755449176043204714246300564837181920116167252587531410770579865354161287032651284433988506760365959771551943693233836893150439601322950204448395793939326263395692343194801455990946985386999145631236730668888152358507056472844154502478864236115132311135338471974293832329546406340854388340421683...
result:
ok single line: '579054755449176043204714246300...4664037648627622908779139432448'
Test #43:
score: 0
Accepted
time: 7ms
memory: 4416kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 23 28 34 35 36 37 38 39 40 41 40 42 43 40 44 45 46 50001 38 47 48 49 50 51 52 53 54 50001 55 56 57 58 59 54 60 61 41 62 50001 63 64 65 66 50001 67 68 69 54 54 70 50001 71 72 73 47 67 64 50001 74 73 75 76 77...
output:
118590413915991253648325477642355678654857239791053329926432925814756424532231584286983052080846184522948561213838068374289795717210030350940201871031458598774018743437791886295338186945942607257425025277282440988293603022245165638482842107671395556379097320517319060335376861091104018606978732118360...
result:
ok single line: '118590413915991253648325477642...1949104389371717179677557653504'
Test #44:
score: 0
Accepted
time: 7ms
memory: 4464kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 24 26 27 37 38 39 40 41 23 42 43 44 45 50001 30 46 47 41 48 49 50 48 51 50001 52 32 41 53 54 50001 55 56 55 57 58 59 60 61 59 62 63 64 65 66 62 67 58 68 69 70 71 57 72 73 73 74 74 75 76 77 78 71 79...
output:
210658892846977703158596067187523599270905875952758865435102332623451858730290780895769579360969786781773935782236983226116314890692447560632064577801718383607754147557841204543894852012084952366111112946502787558766561599279693052869152772059982859039268491083374819679677722723283783436050122116897...
result:
ok single line: '210658892846977703158596067187...7603133448045497198649637076992'
Test #45:
score: 0
Accepted
time: 7ms
memory: 4532kb
input:
50000 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50001 49 29 50 50001 39 48 51 52 32 53 54 55 33 56 57 58 59 57 60 50001 50001 61 62 47 50 45 63 50001 50001 64 65 66 67 68 61 69 70 55 61 50001 71 72 48 73 74 75...
output:
144763688862294010801178561575141209295480029041813146882852692644966338540321758162821108497126690091489942887985923308459223287609900330737551112098948484831565848923085798700363997736746346749786407809182667222038089626764118211038625619716059028783077783834617993573458082386601585213597085105420...
result:
ok single line: '144763688862294010801178561575...3666009412156905727194784858112'
Test #46:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
100 2 3 4 5 6 7 8 9 10 11 11 101 101 12 13 14 15 16 101 17 18 13 18 16 19 20 21 17 17 22 22 18 23 18 24 24 21 25 101 25 101 22 101 23 26 24 27 27 27 28 29 101 30 30 30 31 32 33 34 31 34 32 34 35 36 101 37 35 38 38 39 40 41 42 43 39 44 42 45 46 101 43 43 47 48 49 50 51 52 101 53 50 54 55 101 55 56 57...
output:
17179869184
result:
ok single line: '17179869184'
Extra Test:
score: -3
Extra Test Failed : Wrong Answer on 1
time: 220ms
memory: 4524kb
input:
50000 2 20001 3 20001 4 20001 5 20001 6 20001 7 20001 8 20001 9 20001 10 20001 11 20001 12 20001 13 20001 14 20001 15 20001 16 20001 17 20001 18 20001 19 20001 20 20001 21 20001 22 20001 23 20001 24 20001 25 20001 26 20001 27 20001 28 20001 29 20001 30 20001 31 20001 32 20001 33 20001 34 20001 35 20...
output:
398027684033796659235430720619120245370477278049242593871342686565238635974930057042676009749975595510836461137504912702831400376935319143621753470415827025981215282426893498224826615977707595539466961019588699726772279731941315198182787264034852821200164566127930390710398182979935327718016873784821...
result:
wrong answer 1st lines differ - expected: '794090351913296032413251784349...1581095988135833790694215909376', found: '398027684033796659235430720619...9869570675234892321663406309376'