QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#863070 | #9732. Gathering Mushrooms | Zawos | AC ✓ | 324ms | 108060kb | C++20 | 7.2kb | 2025-01-19 12:41:08 | 2025-01-19 12:41:08 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
using namespace __gnu_pbds;
using ll=long long;
using ld=long double;
using vi=vector<int>;
template<class T> using oset =tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update> ;
//上
const int N = 200005;
const ll inf = 1000000000000000000;
int par[N][20];
int par1[N][20];
ll k;
map<ll,ll>mp;
void init_par(vector<int> &parent){
int n = parent.size();
for(int i = 0; i < n;i++){
if(parent[i] == -1) par[i][0] = i;
else par[i][0] = parent[i];
}
for(int i = 1; i < 20; i++){
for(int j = 0; j < n; j++) par[j][i] = par[par[j][i-1]][i-1];
}
}
void init_par2(vector<int> &parent){
int n = parent.size();
for(int i = 0; i < n;i++){
par1[i][0] = parent[i];
}
for(int i = 1; i < 20; i++){
for(int j = 0; j < n; j++) if(parent[j] != -1) par1[j][i] = par1[par1[j][i-1]][i-1];
}
}
ll jump(int x,int y){
ll su = 1;
for(int i = 19; i>= 0;i--){
if(par[x][i] != y&&par[x][i] != x) x = par[x][i],su +=(1<<i);
}
return su;
}
int move(int x,ll dis){
for(int i = 0; i < 20 ; i++){
if(dis&(1<<i)) x = par[x][i];
}
return x;
}
int move2(int x,ll dis){
for(int i = 0; i < 20 ; i++){
if(dis&(1<<i)) x = par1[x][i];
}
return x;
}
void toposort(int x,vector<vector<int>> &AL,vector<int>&vis,vector<int> &topo){
vis[x] = 1;
for(auto &u: AL[x]){
if(vis[u] == 0) toposort(u,AL,vis,topo);
}
topo.push_back(x);
}
void dfs(int x,int c,vector<vector<int>> &AL,vector<int> &scc){
scc[x] = c;
for(auto &u: AL[x]){
if(scc[u] == -1) dfs(u,c,AL,scc);
}
}
void create_ancester_tree(int x,int root,vector<int> &v,vector<vector<int>> &nAL,vector<int> & parent,vector<int> &last,vector<int>&depth,vector<int>&toerase){
if(x != root){
if(last[v[x]] != -1) parent[x] = last[v[x]];
else parent[x] = root;
last[v[x]] = x;
}
toerase.push_back(v[x]);
for(auto &u: nAL[x]){
depth[u] = depth[x] + 1;
create_ancester_tree(u,root,v,nAL,parent,last,depth,toerase);
}
if(x!=root) last[v[x]] = parent[x];
}
vector<ll> calc_cycle(int x,vector<vector<int>> &AL,vector<int> &v,vector<ll> &ans,vector<ll> &distance,vector<int>&position,vector<int>&last,vector<int>&parent){
ll sz = 1;
int p1 = x;
int p2 = x;
map<int,ll> val;
ll mx = 1;
val[v[x]]++;
position[p1] = sz-1;
last[v[p1]] = -1;
vector<ll> cyc = {x};
while(AL[p1][0] != x){
p1 =AL[p1][0],sz++;
position[p1] = sz-1;
last[v[p1]] = -1;
cyc.push_back(p1);
mx = max(mx,++val[v[p1]]);
}
ll vueltas = ((k+mx-1)/mx-1);
for(auto &u:val){
u.second = u.second*vueltas;
}
p1 = x;
ll d = 0;
val[v[p1]]++;
for(int i = 0; i < sz;i++){
while(true){
if(val[v[p2]] == k){
distance[p1] = vueltas*sz+d;
ans[p1] = v[p2];
break;
}else{
p2 = AL[p2][0];
val[v[p2]]++;
d++;
}
}
d--;
val[v[p1]]--;
p1 = AL[p1][0];
}
p1 = x;
for(int i = 0; i <2*sz;i++){
if(last[v[p1]] != -1){
parent[last[v[p1]]] = p1;
}
last[v[p1]] = p1;
p1 = AL[p1][0];
}
return cyc;
}
void calc_tree(int x,int root,ll sz,vector<vector<int>> &AL,vector<int> &v,vector<ll> & ans,vector<ll> &distance,vector<int> &last,vector<int>&depth,vector<int>&position){
for(auto &u: AL[x]){
ll steps = 0;
ll su = 0;
ll toroot = jump(u,root);
if(toroot >= k){
su = depth[u]-depth[move(u,k-1)];
}else{
if(last[v[u]] !=-1){
steps = toroot;
su = depth[u];
if(position[last[v[u]]] >= position[root]){
su +=position[last[v[u]]] -position[root];
}else{
su += sz-position[root]+position[last[v[u]]];
}
ll many = mp[v[u]];
ll o = (k-steps +many-1)/many-1;
steps += o* many;
su+=o*sz;
ll extra =move2(last[v[u]],k-steps-1);
if(position[extra] >= position[last[v[u]]]){
su += position[extra]-position[last[v[u]]];
}else su += sz-position[last[v[u]]]+position[extra];
}else su = inf;
}
if(su <distance[x] +1){
distance[u] = su;
ans[u] = v[u];
}else{
distance[u] = distance[x]+1;
ans[u] = ans[x];
}
calc_tree(u,root,sz,AL,v,ans,distance,last,depth,position);
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while(t--){
ll n; cin >> n >> k;
vector<vector<int>> AL(n),AL_T(n);
vector<int> v(n),scc(n,-1),vis(n),parent(n,-1),last(n,-1),depth(n),position(n),aux(n,-1);
vector<ll> ans(n,-1),distance(n);
vector<int>topo;
FOR(i,0,n){cin >> v[i];v[i]--;}
FOR(i,0,n){
int x; cin >> x;
x--; AL[i].push_back(x); AL_T[x].push_back(i);
}
for(int i = 0; i < n; i++){
if(!vis[i]) toposort(i,AL,vis,topo);
}
reverse(topo.begin(),topo.end());
int cur = 0;
for(auto &u: topo){
if(scc[u] == -1) dfs(u,cur++,AL_T,scc);
}
vector<vector<int>> nAL(n);
for(int i = 0; i < n; i++){
if(scc[AL[i][0]] != scc[i]) nAL[AL[i][0]].push_back(i);
}
for(int i = 0; i < n; i++){
if(scc[AL[i][0]] == scc[i]){
vector<int> toerase;
create_ancester_tree(i,i,v,nAL,parent,last,depth,toerase);
for(auto &u:toerase) last[u] = -1;
}
}
init_par(parent);
for(int i = 0; i < n; i++) parent[i] = -1;
vector<vector<ll>> temp;
for(int i = 0; i < n; i++){
if(scc[AL[i][0]] == scc[i] && ans[i] == -1){
temp.push_back(calc_cycle(i,AL,v,ans,distance,position,last,parent));
}
}
init_par2(parent);
for(int i = 0; i < n; i++) last[i] = -1;
for(auto &u: temp){
mp.clear();
for(int i = (int)u.size()-1; i >= 0;i--){
last[v[u[i]]] = u[i];
mp[v[u[i]]]++;
}
for(int i = (int)u.size()-1; i >= 0;i--){
last[v[u[i]]] = u[i];
calc_tree(u[i],u[i],u.size(),nAL,v,ans,distance,last,depth,position);
}
for(int i = 0; i < u.size();i++) last[v[u[i]]] = -1;
}
ll re = 0;
// trace(ans);
for(ll i = 1; i <= n;i++) re += i*(ans[i-1]+1);
cout <<re<<'\n';
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 5856kb
input:
3 5 3 2 2 1 3 3 2 5 1 2 4 5 4 2 2 1 3 3 2 5 1 2 4 3 10 1 2 3 1 3 2
output:
41 45 14
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 52ms
memory: 5736kb
input:
6000 19 48 18 19 18 19 11 9 15 19 12 18 11 18 9 18 9 18 19 11 15 12 14 18 8 1 3 19 5 13 14 15 2 14 5 19 2 19 12 9 15 23 3 1 1 3 6 1 4 1 1 6 6 4 12 4 6 14 1 8 8 6 6 12 14 6 8 5 7 14 2 5 9 140979583 4 5 8 9 2 7 6 8 2 8 9 4 6 9 2 4 7 8 4 976357580 2 3 1 3 2 1 1 4 6 508962809 4 3 4 3 4 4 4 5 4 5 5 6 13 ...
output:
3420 260 254 26 84 759 126 30 1092 1 2493 2422 168 360 298 324 2424 2520 220 228 1107 9 3486 1 796 81 340 272 600 3196 32 495 40 128 140 665 1635 702 68 96 90 288 29 588 16 234 445 2928 140 40 477 1197 19 1994 1082 32 522 672 20 390 32 2204 1938 42 21 885 4 1539 196 420 11 1709 801 720 1 556 40 17 2...
result:
ok 6000 lines
Test #3:
score: 0
Accepted
time: 135ms
memory: 73648kb
input:
1 200000 40000 46988 88148 28442 9596 17281 27561 58024 1062 138912 175273 194682 27958 11240 187099 28869 177531 154933 83035 11300 178646 6952 44234 168671 169483 187602 178519 99885 98196 64731 100802 16974 85402 50616 126862 159025 116795 83016 127770 3067 56860 19833 64583 11977 100045 198272 1...
output:
2654974404037027
result:
ok single line: '2654974404037027'
Test #4:
score: 0
Accepted
time: 121ms
memory: 73332kb
input:
1 200000 10000000 172532 195148 85227 155659 14990 35802 156340 83797 197030 21580 88873 28715 24950 12770 82745 113383 51071 21570 147715 85175 15394 148817 70297 38951 36754 55240 181122 186649 17533 4230 68223 4978 154960 144826 26781 185779 18292 195221 34441 37597 148301 81791 67645 197829 3693...
output:
1991871314556006
result:
ok single line: '1991871314556006'
Test #5:
score: 0
Accepted
time: 119ms
memory: 73360kb
input:
1 200000 1000000000 176004 145470 198726 37315 113426 105334 46063 63520 103219 121771 57158 185334 126226 141718 133227 158448 119801 62952 10829 175859 190290 80534 82892 42340 164975 79666 102327 14872 75277 57094 37650 183007 86587 47862 133654 48675 26581 199005 14582 75902 5988 102670 169993 1...
output:
2910045863489510
result:
ok single line: '2910045863489510'
Test #6:
score: 0
Accepted
time: 131ms
memory: 73696kb
input:
1 200000 40000 118673 82089 118673 118673 129221 118673 125539 106895 82089 129221 125539 118673 82089 129221 118673 125539 106895 106895 129221 118673 129221 82089 82089 125539 129221 129221 118673 106895 82089 129221 106895 82089 106895 82089 106895 106895 129221 118673 106895 82089 106895 82089 8...
output:
2404687852449892
result:
ok single line: '2404687852449892'
Test #7:
score: 0
Accepted
time: 134ms
memory: 73544kb
input:
1 200000 10000000 110770 103054 103054 67926 87448 110770 103054 67926 87448 87448 87448 87448 176259 67926 176259 110770 103054 110770 176259 67926 67926 67926 87448 87448 87448 67926 110770 67926 67926 67926 176259 87448 87448 176259 87448 103054 110770 176259 103054 87448 87448 176259 103054 1107...
output:
1871051161222455
result:
ok single line: '1871051161222455'
Test #8:
score: 0
Accepted
time: 135ms
memory: 73528kb
input:
1 200000 1000000000 92387 35422 92387 192988 35422 35422 92387 192988 35422 192988 192988 124898 35422 124898 124898 92387 35422 192988 124898 35422 132532 92387 132532 192988 35422 92387 124898 132532 35422 92387 35422 35422 124898 132532 92387 92387 192988 192988 124898 92387 92387 35422 124898 19...
output:
2226090142242870
result:
ok single line: '2226090142242870'
Test #9:
score: 0
Accepted
time: 120ms
memory: 73236kb
input:
1 200000 40000 116752 38573 63445 128225 135901 46112 158662 189088 148798 191324 45035 154544 80127 91833 149943 48432 92060 43958 137795 77575 36781 45299 178350 100696 60034 61055 85213 69563 78385 21262 146118 102661 187678 130733 9787 16393 117846 185565 60069 3846 141624 104285 39616 57159 868...
output:
1143189663913379
result:
ok single line: '1143189663913379'
Test #10:
score: 0
Accepted
time: 113ms
memory: 73472kb
input:
1 200000 10000000 140527 170359 145004 37893 122429 127925 3461 95526 78195 26127 92887 141377 182681 136498 39270 58777 71455 38154 157727 24834 179001 155490 60975 147064 75506 36710 46141 189903 21088 196674 125247 103266 25995 4763 41038 180967 4283 21509 10323 142860 120149 127930 146726 109420...
output:
677866460957128
result:
ok single line: '677866460957128'
Test #11:
score: 0
Accepted
time: 114ms
memory: 73360kb
input:
1 200000 1000000000 127458 93467 147620 82303 77297 18842 171477 180789 73198 66451 114690 7452 145760 97912 182102 47863 91886 284 142563 117252 129365 135867 136635 64262 196952 183491 187881 182341 82756 135693 126974 12627 194511 30468 29983 30464 28044 129494 64477 122463 141768 103686 105366 2...
output:
1985383835721543
result:
ok single line: '1985383835721543'
Test #12:
score: 0
Accepted
time: 119ms
memory: 70128kb
input:
1 200000 40000 131243 50411 183082 141585 81827 174160 175932 74477 31310 20599 29372 136846 36578 133487 134440 147839 115280 45462 77063 5065 29725 137589 80437 170073 105648 191314 31432 157802 148931 184650 177611 69456 152253 158494 111351 10329 108646 119661 65317 177563 88191 60803 135866 555...
output:
1940771592135540
result:
ok single line: '1940771592135540'
Test #13:
score: 0
Accepted
time: 67ms
memory: 68516kb
input:
1 200000 10000000 152041 174470 165831 197804 141842 124891 172029 99878 29839 80130 188275 172670 60080 40554 177721 183620 68381 153260 43684 146559 5617 163940 5828 28239 152505 98252 150314 82119 197777 166408 147215 105141 138523 31398 31463 145584 147517 170652 189441 191295 120537 44537 57915...
output:
1651721014252886
result:
ok single line: '1651721014252886'
Test #14:
score: 0
Accepted
time: 137ms
memory: 76796kb
input:
1 200000 1000000000 113494 96820 113494 96820 113494 186155 113494 72596 113494 96820 96820 72596 72596 72596 113494 186155 72596 72596 72596 186155 140986 96820 113494 72596 186155 186155 140986 96820 186155 140986 113494 186155 186155 186155 96820 140986 72596 140986 140986 96820 72596 96820 96820...
output:
1451927259600000
result:
ok single line: '1451927259600000'
Test #15:
score: 0
Accepted
time: 233ms
memory: 87996kb
input:
1 200000 40000 4081 16238 11969 107578 198622 110168 135045 77728 131657 124891 24584 12007 91833 83365 54207 177065 31062 5567 193813 13669 194769 184436 37796 38153 154996 103928 4152 167404 164454 179449 1292 90714 631 188401 121030 170338 82614 92709 101075 197243 118713 156023 89703 132201 1498...
output:
551622758100000
result:
ok single line: '551622758100000'
Test #16:
score: 0
Accepted
time: 226ms
memory: 86868kb
input:
1 200000 10000000 118036 3793 5512 165907 172930 121912 186134 148346 83443 148336 65861 79032 153603 834 89892 55452 62702 146776 16844 122756 146483 134711 163729 88863 155117 48251 152885 125608 16053 13493 24658 118369 116062 126154 145675 46280 108793 91814 162570 11989 193985 96015 104182 6961...
output:
631963159800000
result:
ok single line: '631963159800000'
Test #17:
score: 0
Accepted
time: 252ms
memory: 87872kb
input:
1 200000 1000000000 33836 100196 59375 75273 128299 104538 94912 26541 50585 134718 98137 40094 123637 167966 149636 26105 22668 121583 92264 94615 56134 10763 140098 100436 16529 60575 111368 27690 73533 193629 180594 81747 109487 21125 29088 194323 135905 95040 18540 81652 176196 50575 186436 1418...
output:
1518987594900000
result:
ok single line: '1518987594900000'
Test #18:
score: 0
Accepted
time: 198ms
memory: 87564kb
input:
1 200000 40000 81104 81104 124637 80107 79894 80107 79894 124637 79894 81104 80107 108634 124637 80107 80107 124637 124637 81104 80107 80107 80107 80107 108634 79894 124637 79894 124637 124637 80107 79894 108634 124637 108634 79894 108634 124637 81104 80107 79894 80107 81104 124637 80107 80107 81104...
output:
2492752463700000
result:
ok single line: '2492752463700000'
Test #19:
score: 0
Accepted
time: 215ms
memory: 93240kb
input:
1 200000 10000000 113380 113380 6166 113380 73481 196022 142288 113380 142288 113380 196022 113380 73481 73481 142288 6166 6166 142288 142288 6166 6166 6166 6166 73481 73481 113380 196022 73481 196022 73481 73481 196022 113380 113380 6166 6166 196022 6166 6166 73481 113380 6166 113380 113380 73481 6...
output:
3920459602200000
result:
ok single line: '3920459602200000'
Test #20:
score: 0
Accepted
time: 208ms
memory: 101060kb
input:
1 200000 1000000000 55030 139062 93934 139062 139062 188123 93934 93934 55030 93934 93934 93934 188123 139062 55030 79446 79446 93934 93934 79446 93934 79446 188123 188123 55030 79446 55030 139062 93934 79446 188123 79446 93934 188123 139062 188123 188123 93934 55030 93934 55030 188123 93934 79446 5...
output:
1100605503000000
result:
ok single line: '1100605503000000'
Test #21:
score: 0
Accepted
time: 161ms
memory: 108060kb
input:
1 200000 40000 58977 6108 192639 180048 171812 123648 62338 77818 104884 77820 6656 90023 106001 100891 74036 166651 44552 176104 164299 22650 142254 62112 94221 64472 87477 117679 67351 88407 19219 20120 131885 182802 182606 76083 37465 44793 124801 101708 21282 72200 190182 51075 25878 8311 13717 ...
output:
2574846010902855
result:
ok single line: '2574846010902855'
Test #22:
score: 0
Accepted
time: 324ms
memory: 90116kb
input:
1 200000 10000000 32788 36106 63672 13633 133399 118569 177557 164892 70843 121881 44540 191592 148535 126625 128051 88393 11348 191253 59176 1824 105567 87004 192147 103542 76045 169545 147713 110812 53394 193545 30238 132934 71048 87462 48364 120934 93056 95812 50355 38222 11588 87032 123090 10803...
output:
2729241306046102
result:
ok single line: '2729241306046102'
Test #23:
score: 0
Accepted
time: 201ms
memory: 100780kb
input:
1 200000 1000000000 131865 21550 68612 79003 122691 149098 36210 58257 146491 195940 148723 135722 78009 36153 173518 139189 147549 29416 116017 31887 130076 74555 168769 146610 170223 18391 151390 123127 106284 103512 44593 31031 126874 171878 21855 119249 153019 42452 116328 199508 151523 139591 1...
output:
1666108330500000
result:
ok single line: '1666108330500000'
Test #24:
score: 0
Accepted
time: 138ms
memory: 70812kb
input:
1 200000 40000 136112 186291 100280 154449 159476 81489 98318 122844 76856 173595 31743 87091 54046 10622 107038 56139 99877 20376 189082 88641 13927 189464 183573 49637 103012 125344 52481 40353 3113 6858 76911 66861 180277 196605 151580 155980 135714 39503 93410 20548 126999 124971 82085 59247 111...
output:
2441525425533106
result:
ok single line: '2441525425533106'
Test #25:
score: 0
Accepted
time: 212ms
memory: 75780kb
input:
1 200000 10000000 162806 129138 143698 143684 52876 16339 82915 48852 115812 118744 45914 176901 77564 68400 135411 163307 10299 105681 3950 159948 77979 167276 3657 49709 185308 97441 79567 107905 179443 138462 1243 31895 156534 38122 171958 51476 17616 90813 28861 54137 63981 33759 189645 82105 19...
output:
2144464394695140
result:
ok single line: '2144464394695140'
Test #26:
score: 0
Accepted
time: 151ms
memory: 71772kb
input:
1 200000 1000000000 78833 145328 38486 129536 60040 9191 30204 80118 112190 47996 93256 178969 179815 100815 132643 100687 150108 137864 37775 26735 138430 169640 72378 29061 17640 29159 190247 113685 153946 121291 196453 35286 199171 88414 14895 84356 188662 83162 13022 112994 121011 131189 27284 1...
output:
3315416577000000
result:
ok single line: '3315416577000000'
Test #27:
score: 0
Accepted
time: 83ms
memory: 70876kb
input:
1 200000 40000 171393 130093 24874 162947 91299 171393 91299 24874 91299 91299 171393 24874 171393 130093 130093 130093 130093 130093 91299 91299 24874 162947 171393 162947 91299 91299 171393 91299 171393 24874 162947 91299 24874 130093 171393 162947 162947 171393 162947 24874 91299 162947 24874 912...
output:
2601873009300000
result:
ok single line: '2601873009300000'
Test #28:
score: 0
Accepted
time: 116ms
memory: 72964kb
input:
1 200000 10000000 192275 54817 112201 192275 54817 112201 173719 173719 96044 54817 96044 192275 54817 173719 192275 96044 173719 112201 54817 112201 112201 173719 54817 173719 192275 192275 192275 192275 96044 112201 173719 173719 112201 173719 96044 173719 173719 54817 192275 192275 112201 96044 1...
output:
3474397371900000
result:
ok single line: '3474397371900000'
Test #29:
score: 0
Accepted
time: 122ms
memory: 75260kb
input:
1 200000 1000000000 170945 122563 21753 21753 122563 21753 21753 170945 21753 170945 4558 122563 76598 21753 4558 122563 4558 21753 4558 122563 170945 21753 122563 4558 4558 170945 76598 170945 21753 76598 76598 170945 21753 170945 170945 76598 122563 4558 4558 76598 21753 21753 170945 76598 170945 ...
output:
91160455800000
result:
ok single line: '91160455800000'
Test #30:
score: 0
Accepted
time: 124ms
memory: 72240kb
input:
1 200000 40000 57272 148259 103913 35535 50615 42658 98719 181844 114732 939 195461 181376 140503 163961 70721 88757 84109 32701 174170 115475 34835 110046 125377 93603 71528 195519 112461 176353 51147 9256 162324 87296 23871 58118 63695 162693 31707 187748 178014 63229 103282 156388 81694 199276 15...
output:
3133634911846493
result:
ok single line: '3133634911846493'
Test #31:
score: 0
Accepted
time: 291ms
memory: 79712kb
input:
1 200000 10000000 112500 90246 62921 195911 136745 199776 44489 40804 99619 17241 119733 56381 139049 166317 40861 78167 49111 156547 114170 109702 101822 1745 174847 17521 53424 18555 11372 93868 115988 64517 42497 76581 2809 66033 78528 37839 154393 188229 79261 192324 31000 20862 147336 153027 12...
output:
3651098255400000
result:
ok single line: '3651098255400000'
Test #32:
score: 0
Accepted
time: 169ms
memory: 74288kb
input:
1 200000 1000000000 132700 119807 185544 154491 117888 74807 94376 195743 82179 66540 129245 122016 35981 99582 175418 194522 149003 154339 9846 20288 25216 101070 144 3633 143873 43429 17472 168735 139908 3295 171802 117288 142673 135841 37402 140757 88637 68374 76847 150625 188354 11779 157491 101...
output:
1245466695260976
result:
ok single line: '1245466695260976'
Test #33:
score: 0
Accepted
time: 78ms
memory: 97208kb
input:
1 200000 1000000000 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
36271232538
result:
ok single line: '36271232538'
Test #34:
score: 0
Accepted
time: 80ms
memory: 41628kb
input:
101 804 569255960 501 134 501 605 605 501 134 605 605 501 605 501 134 605 605 134 407 501 407 501 605 407 134 134 605 605 134 501 501 134 407 501 501 407 134 501 605 134 134 134 501 134 407 605 605 501 501 407 134 501 501 407 501 407 134 134 605 605 605 407 407 605 134 605 605 605 134 407 605 501 13...
output:
185188538 146878847 245029219 352163694 185664666 94118714 415029105 144072128 190478600 164704080 51196302 300909977 225338145 126775054 155573423 200853919 166334503 216122690 183227794 68795056 189590304 37198542 261504691 115368648 93078486 111333313 287317913 126177627 261544569 168326353 22496...
result:
ok 101 lines
Extra Test:
score: 0
Extra Test Passed