QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#643141 | #7413. Determinant | 11d10xy | AC ✓ | 68ms | 9728kb | C++14 | 2.3kb | 2024-10-15 19:12:59 | 2024-10-15 19:13:01 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using i64=long long;
constexpr i64 mod=998244353;
inline i64 qpow(i64 p,i64 t){
i64 r=1;for(;t;t>>=1,p=p*p%mod)if(t&1)(r*=p)%=mod;
return r;
}
int n,m,k,dfn[25010],low[25010],stk[25010],tp,tot;
vector<int>G[25010];
i64 f[25010][2];
namespace det{
i64 a[30][30];
i64 calc(int n){
i64 res=1;
for(int i=0;i<n;i++){
for(int j=i+1;j<n&&!a[i][i];j++)if(a[j][i])swap(a[i],a[j]),res=mod-res;
if(!a[i][i])return 0;
(res*=a[i][i])%=mod;
i64 w=qpow(a[i][i],mod-2);
for(int k=0;k<n;k++)(a[i][k]*=w)%=mod;
for(int j=i+1;j<n;j++){
i64 w=mod-a[j][i];
for(int k=0;k<n;k++)(a[j][k]+=a[i][k]*w)%=mod;
}
}return res;
}
}
void tarjan(int u,int fa){
dfn[u]=low[u]=++tot,stk[++tp]=u;
for(int v:G[u])if(!dfn[v]){
tarjan(v,u),low[u]=min(low[u],low[v]);
}else if(v!=fa)low[u]=min(low[u],dfn[v]);
if(!fa||low[u]>dfn[fa]){
memset(det::a,0,sizeof(det::a));
vector<int>S;
do S.push_back(stk[tp--]);
while(S.back()!=u);
map<int,int>id;
vector<i64>coef(S.size(),1);
for(int i=0;i<S.size();i++)id[S[i]]=i;
for(int u:S){
int U=id[u];
vector<int>oth;
for(int v:G[u])if(v!=fa){
if(!id.count(v))oth.push_back(v);
else det::a[U][id[v]]=1;
}
if(!oth.empty()){
vector<i64>suf(oth.size());
suf[oth.size()-1]=1;
for(int i=oth.size()-1;i;i--)suf[i-1]=suf[i]*f[oth[i]][0]%mod;
i64 pre=1;
for(int i=0;i<oth.size();i++){
(det::a[U][U]+=pre*suf[i]%mod*f[oth[i]][1])%=mod;
(pre*=f[oth[i]][0])%=mod;
}
for(int k=0;k<S.size();k++)if(k!=U)(det::a[U][k]*=pre)%=mod;
coef[U]=pre;
}
}
i64 b[30][30];
memcpy(b,det::a,sizeof(det::a));
f[u][0]=det::calc(S.size());
memcpy(det::a,b,sizeof(b));
fill_n(det::a[id[u]],30,0);
det::a[id[u]][id[u]]=mod-coef[id[u]];
f[u][1]=det::calc(S.size());
}
}
int main(){
scanf("%d%d%d",&n,&m,&k);
for(int u,v;m--;){
scanf("%d%d",&u,&v);
G[u].push_back(v),G[v].push_back(u);
}
tarjan(1,0);
printf("%lld",f[1][0]);
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 4408kb
input:
4 3 1 1 2 2 3 3 4
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 1ms
memory: 4728kb
input:
6 6 3 2 3 5 6 2 5 1 2 3 4 6 2
output:
998244352
result:
ok 1 number(s): "998244352"
Test #3:
score: 0
Accepted
time: 1ms
memory: 4524kb
input:
10 15 10 1 8 1 7 6 7 2 8 6 9 1 2 4 9 4 10 4 6 5 6 3 8 9 10 8 10 3 5 2 7
output:
35
result:
ok 1 number(s): "35"
Test #4:
score: 0
Accepted
time: 1ms
memory: 4432kb
input:
10 9 1 1 2 1 3 3 4 3 5 1 6 3 7 6 8 3 9 8 10
output:
0
result:
ok 1 number(s): "0"
Test #5:
score: 0
Accepted
time: 1ms
memory: 4476kb
input:
1 0 1
output:
0
result:
ok 1 number(s): "0"
Test #6:
score: 0
Accepted
time: 1ms
memory: 4416kb
input:
10 9 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10
output:
0
result:
ok 1 number(s): "0"
Test #7:
score: 0
Accepted
time: 1ms
memory: 4752kb
input:
10 12 3 3 5 5 9 5 10 1 2 1 3 2 3 4 5 4 6 5 6 7 8 7 9 8 9
output:
4
result:
ok 1 number(s): "4"
Test #8:
score: 0
Accepted
time: 1ms
memory: 4512kb
input:
10 12 3 3 5 1 8 6 10 1 2 1 3 2 3 4 5 4 6 5 6 7 8 7 9 8 9
output:
3
result:
ok 1 number(s): "3"
Test #9:
score: 0
Accepted
time: 1ms
memory: 4452kb
input:
10 11 3 1 2 1 3 1 8 1 9 3 4 3 5 4 5 6 7 6 8 7 8 9 10
output:
4
result:
ok 1 number(s): "4"
Test #10:
score: 0
Accepted
time: 1ms
memory: 4384kb
input:
10 11 3 1 2 1 3 1 6 1 9 3 4 3 5 4 5 6 7 6 8 7 8 9 10
output:
4
result:
ok 1 number(s): "4"
Test #11:
score: 0
Accepted
time: 1ms
memory: 4528kb
input:
10 15 7 2 9 1 2 1 4 1 6 1 7 2 3 2 5 2 6 3 5 4 5 4 6 5 6 8 9 8 10 9 10
output:
3
result:
ok 1 number(s): "3"
Test #12:
score: 0
Accepted
time: 1ms
memory: 4520kb
input:
10 25 7 4 10 1 2 1 3 1 4 1 5 1 6 1 7 2 3 2 4 2 5 2 6 2 7 3 4 3 5 3 6 3 7 4 5 4 6 4 7 5 6 5 7 6 7 8 9 8 10 9 10
output:
7
result:
ok 1 number(s): "7"
Test #13:
score: 0
Accepted
time: 1ms
memory: 4412kb
input:
10 12 7 1 2 1 5 1 10 3 4 3 7 3 9 4 6 4 9 5 8 6 9 7 8 8 9
output:
0
result:
ok 1 number(s): "0"
Test #14:
score: 0
Accepted
time: 1ms
memory: 4492kb
input:
10 24 7 1 2 1 4 1 10 3 4 3 5 3 6 3 7 3 8 3 9 4 5 4 6 4 7 4 8 4 9 5 6 5 7 5 8 5 9 6 7 6 8 6 9 7 8 7 9 8 9
output:
0
result:
ok 1 number(s): "0"
Test #15:
score: 0
Accepted
time: 1ms
memory: 4772kb
input:
10 18 10 1 3 1 5 1 6 1 8 1 9 2 5 2 7 2 9 3 5 3 9 3 10 4 5 4 10 5 6 6 7 6 8 7 9 8 9
output:
998244349
result:
ok 1 number(s): "998244349"
Test #16:
score: 0
Accepted
time: 1ms
memory: 4444kb
input:
10 45 10 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 3 4 3 5 3 6 3 7 3 8 3 9 3 10 4 5 4 6 4 7 4 8 4 9 4 10 5 6 5 7 5 8 5 9 5 10 6 7 6 8 6 9 6 10 7 8 7 9 7 10 8 9 8 10 9 10
output:
998244344
result:
ok 1 number(s): "998244344"
Test #17:
score: 0
Accepted
time: 1ms
memory: 4460kb
input:
10 14 10 1 2 1 10 3 5 4 6 4 8 4 9 5 6 5 8 5 9 6 8 6 9 7 8 8 9 9 10
output:
998244352
result:
ok 1 number(s): "998244352"
Test #18:
score: 0
Accepted
time: 1ms
memory: 4508kb
input:
10 30 10 1 2 1 10 3 4 3 5 3 6 3 7 3 8 3 9 3 10 4 5 4 6 4 7 4 8 4 9 4 10 5 6 5 7 5 8 5 9 5 10 6 7 6 8 6 9 6 10 7 8 7 9 7 10 8 9 8 10 9 10
output:
7
result:
ok 1 number(s): "7"
Test #19:
score: 0
Accepted
time: 1ms
memory: 4476kb
input:
10 24 15 1 3 1 4 1 5 1 6 1 9 2 3 2 4 2 5 2 7 2 9 2 10 3 5 3 6 4 6 4 7 4 9 4 10 6 7 6 8 6 9 7 9 7 10 8 10 9 10
output:
16
result:
ok 1 number(s): "16"
Test #20:
score: 0
Accepted
time: 1ms
memory: 4448kb
input:
10 45 15 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 3 4 3 5 3 6 3 7 3 8 3 9 3 10 4 5 4 6 4 7 4 8 4 9 4 10 5 6 5 7 5 8 5 9 5 10 6 7 6 8 6 9 6 10 7 8 7 9 7 10 8 9 8 10 9 10
output:
998244344
result:
ok 1 number(s): "998244344"
Test #21:
score: 0
Accepted
time: 1ms
memory: 4416kb
input:
10 16 15 1 2 1 6 3 5 3 6 3 7 3 9 3 10 4 7 4 9 4 10 5 10 6 8 6 9 7 9 7 10 8 9
output:
7
result:
ok 1 number(s): "7"
Test #22:
score: 0
Accepted
time: 1ms
memory: 4508kb
input:
10 30 15 1 2 1 7 3 4 3 5 3 6 3 7 3 8 3 9 3 10 4 5 4 6 4 7 4 8 4 9 4 10 5 6 5 7 5 8 5 9 5 10 6 7 6 8 6 9 6 10 7 8 7 9 7 10 8 9 8 10 9 10
output:
7
result:
ok 1 number(s): "7"
Test #23:
score: 0
Accepted
time: 1ms
memory: 4780kb
input:
10 20 25 1 2 1 7 1 8 1 9 2 3 2 5 2 6 2 9 2 10 3 6 3 10 4 6 4 8 5 6 5 7 6 9 7 9 8 9 8 10 9 10
output:
11
result:
ok 1 number(s): "11"
Test #24:
score: 0
Accepted
time: 1ms
memory: 4480kb
input:
10 45 25 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 3 4 3 5 3 6 3 7 3 8 3 9 3 10 4 5 4 6 4 7 4 8 4 9 4 10 5 6 5 7 5 8 5 9 5 10 6 7 6 8 6 9 6 10 7 8 7 9 7 10 8 9 8 10 9 10
output:
998244344
result:
ok 1 number(s): "998244344"
Test #25:
score: 0
Accepted
time: 1ms
memory: 4468kb
input:
10 18 25 1 2 1 9 3 5 3 9 3 10 4 6 4 7 4 9 4 10 5 7 5 9 5 10 6 7 6 9 7 9 7 10 8 9 8 10
output:
998244352
result:
ok 1 number(s): "998244352"
Test #26:
score: 0
Accepted
time: 1ms
memory: 4472kb
input:
10 30 25 1 2 1 10 3 4 3 5 3 6 3 7 3 8 3 9 3 10 4 5 4 6 4 7 4 8 4 9 4 10 5 6 5 7 5 8 5 9 5 10 6 7 6 8 6 9 6 10 7 8 7 9 7 10 8 9 8 10 9 10
output:
7
result:
ok 1 number(s): "7"
Test #27:
score: 0
Accepted
time: 1ms
memory: 4868kb
input:
1000 999 1 1 2 1 3 1 4 4 5 5 6 4 7 1 8 6 9 9 10 9 11 11 12 11 13 11 14 5 15 6 16 4 17 16 18 10 19 8 20 6 21 16 22 14 23 22 24 4 25 6 26 14 27 27 28 26 29 6 30 28 31 20 32 10 33 26 34 21 35 16 36 33 37 4 38 27 39 19 40 24 41 35 42 33 43 36 44 22 45 12 46 9 47 3 48 34 49 12 50 28 51 41 52 7 53 39 54 3...
output:
0
result:
ok 1 number(s): "0"
Test #28:
score: 0
Accepted
time: 0ms
memory: 4464kb
input:
1000 999 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 ...
output:
0
result:
ok 1 number(s): "0"
Test #29:
score: 0
Accepted
time: 0ms
memory: 4936kb
input:
1000 1332 3 3 5 5 9 8 10 8 13 13 16 15 21 6 22 23 26 1 30 4 31 8 36 36 39 4 41 21 44 42 48 33 51 14 53 48 57 10 60 46 63 55 64 10 67 42 71 42 75 1 78 16 80 50 83 81 85 69 90 80 93 55 96 10 98 16 100 101 103 85 108 18 110 1 112 85 115 37 120 75 121 45 124 15 129 80 132 29 134 71 136 132 141 85 144 12...
output:
56551060
result:
ok 1 number(s): "56551060"
Test #30:
score: 0
Accepted
time: 1ms
memory: 4672kb
input:
1000 1332 3 1 4 6 7 7 11 1 13 8 16 4 19 12 23 4 25 18 29 9 31 2 35 26 39 15 42 10 43 30 46 17 49 45 53 48 56 19 59 38 62 17 65 17 67 15 70 11 73 72 77 78 79 25 84 80 87 20 88 8 93 59 94 73 98 75 102 94 105 59 108 84 111 15 113 88 116 57 120 42 122 14 126 55 129 11 131 59 135 39 137 128 140 51 144 12...
output:
989092356
result:
ok 1 number(s): "989092356"
Test #31:
score: 0
Accepted
time: 1ms
memory: 4760kb
input:
1000 1331 3 1 2 1 3 1 6 1 10 1 14 1 15 1 18 1 23 1 25 1 27 1 31 1 35 1 38 1 39 1 44 1 45 1 48 1 52 1 54 1 57 1 61 1 63 1 67 1 71 1 73 1 76 1 78 1 81 1 86 1 89 1 92 1 95 1 97 1 101 1 102 1 107 1 108 1 112 1 114 1 118 1 120 1 125 1 126 1 131 1 132 1 136 1 139 1 143 1 144 1 147 1 150 1 153 1 158 1 159 ...
output:
179729948
result:
ok 1 number(s): "179729948"
Test #32:
score: 0
Accepted
time: 1ms
memory: 4524kb
input:
1000 1331 3 1 2 1 4 1 7 1 9 1 13 1 16 1 19 1 22 1 26 1 29 1 30 1 34 1 38 1 40 1 44 1 46 1 49 1 52 1 55 1 57 1 60 1 64 1 67 1 69 1 74 1 77 1 78 1 83 1 85 1 89 1 91 1 95 1 96 1 101 1 104 1 106 1 108 1 111 1 114 1 119 1 121 1 124 1 128 1 129 1 133 1 137 1 140 1 142 1 144 1 149 1 150 1 153 1 158 1 160 1...
output:
179729948
result:
ok 1 number(s): "179729948"
Test #33:
score: 0
Accepted
time: 2ms
memory: 5076kb
input:
1000 1747 7 7 8 7 20 2 22 10 34 34 38 31 43 33 52 39 58 58 64 27 76 2 80 76 89 89 98 66 100 45 107 60 115 109 126 119 130 16 137 3 147 122 150 89 158 105 168 62 169 93 180 50 187 130 192 81 198 21 205 3 216 90 220 172 227 229 238 221 244 59 246 31 256 71 262 181 271 63 278 246 282 121 294 205 298 14...
output:
721276012
result:
ok 1 number(s): "721276012"
Test #34:
score: 0
Accepted
time: 0ms
memory: 4840kb
input:
1000 3139 7 2 11 9 17 13 26 24 35 3 41 12 43 27 52 48 62 34 69 38 71 66 78 22 89 15 96 72 104 15 111 23 114 59 124 90 130 133 134 11 144 78 152 132 158 94 167 155 173 119 178 173 189 75 196 192 200 104 210 54 216 95 218 95 229 84 232 79 244 243 252 240 258 93 265 138 272 102 276 55 283 78 294 12 298...
output:
576050090
result:
ok 1 number(s): "576050090"
Test #35:
score: 0
Accepted
time: 1ms
memory: 4524kb
input:
1000 1758 7 1 2 1 4 1 13 1 23 1 24 1 31 1 38 1 45 1 55 1 62 1 66 1 78 1 81 1 90 1 96 1 102 1 112 1 115 1 125 1 131 1 139 1 146 1 154 1 159 1 167 1 177 1 183 1 187 1 192 1 202 1 208 1 218 1 223 1 228 1 237 1 245 1 251 1 255 1 265 1 274 1 276 1 288 1 294 1 299 1 307 1 314 1 320 1 328 1 333 1 340 1 352...
output:
703853731
result:
ok 1 number(s): "703853731"
Test #36:
score: 0
Accepted
time: 2ms
memory: 4548kb
input:
1000 3132 7 1 2 1 4 1 16 1 20 1 24 1 31 1 39 1 49 1 56 1 63 1 66 1 79 1 83 1 92 1 100 1 101 1 108 1 116 1 128 1 135 1 138 1 147 1 153 1 157 1 168 1 176 1 183 1 189 1 198 1 202 1 208 1 217 1 224 1 228 1 236 1 247 1 249 1 260 1 263 1 273 1 277 1 287 1 296 1 297 1 308 1 311 1 324 1 328 1 338 1 342 1 34...
output:
900612370
result:
ok 1 number(s): "900612370"
Test #37:
score: 0
Accepted
time: 2ms
memory: 5160kb
input:
1000 2371 10 8 11 18 27 12 36 38 43 48 60 49 66 26 79 5 85 72 95 20 106 7 114 36 126 84 139 52 147 150 158 4 168 77 179 39 183 68 196 62 203 60 219 22 221 19 238 71 242 26 254 229 264 123 271 202 287 154 294 139 304 231 317 46 326 262 336 215 347 206 355 242 364 277 380 7 385 311 400 237 407 5 414 2...
output:
41358971
result:
ok 1 number(s): "41358971"
Test #38:
score: 0
Accepted
time: 0ms
memory: 4800kb
input:
1000 4599 10 2 11 2 24 24 32 12 47 45 51 17 67 41 71 28 89 34 96 62 103 15 111 116 129 25 136 123 149 104 151 125 168 96 173 136 181 93 197 73 205 205 214 85 227 32 237 56 244 2 257 125 267 47 275 213 285 158 296 68 306 247 314 255 328 43 338 276 348 113 359 150 367 305 379 79 383 202 400 196 405 34...
output:
996745867
result:
ok 1 number(s): "996745867"
Test #39:
score: 0
Accepted
time: 2ms
memory: 4812kb
input:
1000 2379 10 1 2 1 12 1 19 1 30 1 35 1 52 1 60 1 65 1 80 1 91 1 93 1 105 1 115 1 125 1 141 1 147 1 154 1 164 1 182 1 186 1 198 1 212 1 222 1 230 1 240 1 243 1 254 1 267 1 281 1 286 1 299 1 312 1 313 1 331 1 340 1 344 1 359 1 368 1 381 1 385 1 396 1 404 1 415 1 425 1 436 1 447 1 457 1 464 1 478 1 486...
output:
693447153
result:
ok 1 number(s): "693447153"
Test #40:
score: 0
Accepted
time: 2ms
memory: 4880kb
input:
1000 4584 10 1 2 1 9 1 15 1 23 1 38 1 50 1 59 1 68 1 81 1 87 1 95 1 103 1 113 1 128 1 134 1 151 1 153 1 165 1 173 1 188 1 199 1 207 1 215 1 230 1 240 1 250 1 258 1 265 1 273 1 289 1 301 1 312 1 321 1 325 1 334 1 349 1 361 1 369 1 380 1 391 1 395 1 404 1 414 1 430 1 442 1 448 1 457 1 463 1 477 1 492 ...
output:
718963985
result:
ok 1 number(s): "718963985"
Test #41:
score: 0
Accepted
time: 2ms
memory: 5012kb
input:
1000 3541 15 2 24 14 37 6 52 16 62 58 82 12 99 21 107 60 124 126 138 77 157 125 175 53 194 2 201 172 220 194 231 159 248 14 266 83 278 276 291 198 307 74 330 104 332 22 358 108 375 102 383 295 397 281 418 68 428 172 442 60 456 440 469 332 483 99 502 207 524 134 537 284 541 369 563 416 575 394 592 39...
output:
78661251
result:
ok 1 number(s): "78661251"
Test #42:
score: 0
Accepted
time: 2ms
memory: 5336kb
input:
1000 7041 15 12 30 5 44 5 47 50 70 54 87 46 104 4 118 84 124 66 150 89 162 111 170 171 193 187 199 63 215 18 235 85 253 142 269 28 283 46 292 104 315 249 320 189 332 236 357 77 367 316 378 137 405 164 408 71 432 366 448 374 460 457 470 177 481 402 496 419 523 525 533 247 554 423 556 419 579 239 590 ...
output:
70436014
result:
ok 1 number(s): "70436014"
Test #43:
score: 0
Accepted
time: 0ms
memory: 4608kb
input:
1000 3532 15 1 2 1 17 1 30 1 43 1 52 1 70 1 80 1 103 1 118 1 127 1 148 1 163 1 175 1 194 1 199 1 222 1 242 1 251 1 261 1 281 1 295 1 313 1 322 1 346 1 351 1 367 1 387 1 394 1 419 1 437 1 442 1 464 1 479 1 491 1 506 1 523 1 535 1 548 1 572 1 579 1 591 1 607 1 618 1 643 1 659 1 677 1 679 1 696 1 708 1...
output:
449126096
result:
ok 1 number(s): "449126096"
Test #44:
score: 0
Accepted
time: 2ms
memory: 4708kb
input:
1000 7026 15 1 2 1 15 1 25 1 37 1 51 1 68 1 90 1 102 1 114 1 132 1 144 1 155 1 173 1 189 1 203 1 226 1 229 1 249 1 261 1 274 1 299 1 313 1 321 1 339 1 361 1 367 1 392 1 398 1 411 1 425 1 444 1 455 1 473 1 491 1 511 1 523 1 536 1 553 1 571 1 581 1 597 1 609 1 623 1 635 1 652 1 668 1 679 1 694 1 721 1...
output:
438565245
result:
ok 1 number(s): "438565245"
Test #45:
score: 0
Accepted
time: 3ms
memory: 5600kb
input:
1000 6064 25 20 46 40 60 58 98 2 105 84 127 125 162 92 188 183 203 31 227 230 257 234 299 3 316 36 333 260 352 295 387 218 403 417 450 304 473 310 498 31 518 488 526 212 565 269 581 567 625 390 642 442 656 237 687 239 719 282 741 214 753 62 791 778 816 459 849 628 859 318 891 28 908 330 948 608 960 ...
output:
81250834
result:
ok 1 number(s): "81250834"
Test #46:
score: 0
Accepted
time: 4ms
memory: 5596kb
input:
1000 12039 25 14 28 27 62 71 82 74 123 88 142 148 174 136 190 43 215 165 248 75 252 188 290 216 316 178 346 36 370 375 376 104 422 50 447 110 456 244 477 157 522 159 536 18 555 543 580 512 616 126 643 194 668 44 684 270 717 179 738 363 768 282 798 512 818 110 837 376 858 763 880 689 921 581 928 480 ...
output:
314133358
result:
ok 1 number(s): "314133358"
Test #47:
score: 0
Accepted
time: 3ms
memory: 4696kb
input:
1000 6054 25 1 2 1 9 1 45 1 67 1 97 1 116 1 139 1 170 1 185 1 210 1 237 1 261 1 282 1 321 1 330 1 376 1 379 1 404 1 448 1 460 1 495 1 507 1 530 1 554 1 592 1 606 1 636 1 670 1 681 1 715 1 735 1 777 1 779 1 821 1 837 1 870 1 883 1 923 1 947 1 974 1 987 3 5 3 6 3 8 3 9 3 12 3 14 3 15 3 16 3 20 3 22 3 ...
output:
827825637
result:
ok 1 number(s): "827825637"
Test #48:
score: 0
Accepted
time: 3ms
memory: 5068kb
input:
1000 11994 25 1 2 1 7 1 51 1 65 1 99 1 120 1 130 1 166 1 202 1 205 1 228 1 273 1 294 1 319 1 344 1 370 1 396 1 403 1 435 1 472 1 485 1 522 1 529 1 577 1 592 1 614 1 633 1 673 1 699 1 708 1 746 1 767 1 788 1 820 1 835 1 875 1 895 1 906 1 939 1 955 1 992 3 4 3 5 3 6 3 7 3 8 3 9 3 10 3 11 3 12 3 13 3 1...
output:
31656441
result:
ok 1 number(s): "31656441"
Test #49:
score: 0
Accepted
time: 7ms
memory: 5404kb
input:
10000 9999 1 1 2 2 3 1 4 4 5 3 6 1 7 1 8 8 9 1 10 7 11 10 12 5 13 2 14 14 15 1 16 1 17 2 18 11 19 8 20 14 21 11 22 4 23 22 24 12 25 18 26 14 27 27 28 20 29 20 30 18 31 29 32 17 33 7 34 12 35 33 36 35 37 30 38 36 39 19 40 38 41 9 42 15 43 1 44 3 45 24 46 2 47 28 48 19 49 21 50 49 51 3 52 29 53 49 54 ...
output:
0
result:
ok 1 number(s): "0"
Test #50:
score: 0
Accepted
time: 6ms
memory: 5120kb
input:
10000 9999 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 ...
output:
0
result:
ok 1 number(s): "0"
Test #51:
score: 0
Accepted
time: 3ms
memory: 5268kb
input:
10000 13332 3 1 6 3 8 8 12 8 14 11 18 5 21 19 23 6 25 2 29 29 31 26 35 19 38 9 41 4 44 25 48 22 51 22 53 31 56 31 60 12 62 32 64 34 68 7 72 42 73 23 76 19 80 51 83 74 87 30 90 1 91 82 96 33 99 50 102 24 104 33 108 2 110 105 112 36 117 62 118 95 121 93 125 109 129 102 132 128 135 108 138 54 139 36 14...
output:
0
result:
ok 1 number(s): "0"
Test #52:
score: 0
Accepted
time: 7ms
memory: 5300kb
input:
10000 13332 3 2 4 1 7 6 10 3 14 9 18 13 20 4 24 10 26 6 28 18 33 17 34 33 39 29 42 34 44 14 47 9 49 1 52 37 56 4 59 49 61 14 65 52 68 7 72 36 73 69 77 68 81 26 83 62 85 26 88 21 92 86 94 95 98 82 101 41 105 6 106 93 111 24 112 21 117 80 118 10 121 71 126 38 129 113 131 1 135 113 137 48 140 107 143 7...
output:
0
result:
ok 1 number(s): "0"
Test #53:
score: 0
Accepted
time: 7ms
memory: 5132kb
input:
10000 13331 3 1 2 1 3 1 8 1 10 1 13 1 16 1 20 1 21 1 26 1 27 1 32 1 33 1 38 1 39 1 42 1 47 1 48 1 53 1 54 1 57 1 61 1 63 1 66 1 69 1 73 1 76 1 79 1 83 1 86 1 87 1 92 1 95 1 97 1 100 1 102 1 107 1 109 1 111 1 114 1 118 1 122 1 123 1 126 1 130 1 134 1 137 1 138 1 141 1 144 1 148 1 152 1 153 1 157 1 16...
output:
389072946
result:
ok 1 number(s): "389072946"
Test #54:
score: 0
Accepted
time: 7ms
memory: 5100kb
input:
10000 13331 3 1 2 1 3 1 6 1 11 1 13 1 17 1 20 1 22 1 25 1 27 1 32 1 35 1 38 1 40 1 42 1 46 1 48 1 52 1 55 1 58 1 62 1 64 1 66 1 69 1 72 1 75 1 80 1 81 1 86 1 87 1 90 1 95 1 96 1 100 1 104 1 105 1 109 1 112 1 114 1 119 1 121 1 123 1 128 1 129 1 133 1 135 1 138 1 141 1 146 1 149 1 152 1 153 1 157 1 16...
output:
389072946
result:
ok 1 number(s): "389072946"
Test #55:
score: 0
Accepted
time: 9ms
memory: 5404kb
input:
10000 17660 7 7 11 11 17 7 26 9 32 26 37 23 45 27 50 55 60 5 70 49 75 57 81 67 89 33 98 87 99 12 109 42 117 16 121 126 129 35 135 50 144 141 150 17 156 6 162 63 171 29 178 33 189 132 195 42 203 119 208 142 211 150 223 220 231 21 233 38 242 141 251 79 257 248 264 19 268 173 277 64 283 233 289 135 301...
output:
0
result:
ok 1 number(s): "0"
Test #56:
score: 0
Accepted
time: 10ms
memory: 5592kb
input:
10000 31422 7 6 12 6 16 15 23 24 30 23 41 4 45 16 51 4 63 37 68 50 73 48 82 42 86 16 92 34 100 31 108 11 116 85 125 95 130 46 139 58 145 43 148 32 161 18 168 103 175 136 178 177 188 77 192 10 198 7 209 81 217 156 224 146 229 149 236 85 239 191 248 11 257 18 260 28 270 97 277 266 284 183 289 261 297 ...
output:
466330116
result:
ok 1 number(s): "466330116"
Test #57:
score: 0
Accepted
time: 4ms
memory: 4964kb
input:
10000 17709 7 1 2 1 5 1 16 1 20 1 24 1 33 1 41 1 46 1 55 1 64 1 70 1 78 1 81 1 87 1 95 1 104 1 110 1 116 1 126 1 134 1 136 1 149 1 156 1 158 1 170 1 176 1 183 1 186 1 195 1 201 1 206 1 219 1 220 1 229 1 235 1 244 1 250 1 255 1 263 1 269 1 279 1 288 1 296 1 298 1 306 1 317 1 323 1 325 1 333 1 339 1 3...
output:
289541494
result:
ok 1 number(s): "289541494"
Test #58:
score: 0
Accepted
time: 9ms
memory: 5196kb
input:
10000 31419 7 1 2 1 8 1 13 1 21 1 30 1 33 1 42 1 50 1 57 1 59 1 71 1 76 1 83 1 87 1 100 1 107 1 111 1 116 1 122 1 135 1 141 1 149 1 155 1 158 1 165 1 175 1 182 1 187 1 197 1 204 1 211 1 214 1 221 1 229 1 238 1 242 1 251 1 257 1 264 1 270 1 279 1 286 1 293 1 303 1 308 1 311 1 323 1 328 1 338 1 341 1 ...
output:
817088618
result:
ok 1 number(s): "817088618"
Test #59:
score: 0
Accepted
time: 11ms
memory: 5792kb
input:
10000 23794 10 6 19 13 23 14 31 9 46 28 58 50 70 25 72 64 82 59 97 37 107 92 111 28 122 12 140 104 143 37 159 30 168 137 178 82 182 135 191 29 201 49 212 102 230 51 237 83 241 153 258 213 267 181 276 55 284 279 291 80 307 178 320 162 323 1 335 119 350 292 359 5 367 54 371 302 387 267 395 391 404 12 ...
output:
754772652
result:
ok 1 number(s): "754772652"
Test #60:
score: 0
Accepted
time: 13ms
memory: 6128kb
input:
10000 45999 10 1 19 5 26 18 36 28 46 37 57 12 64 46 74 2 81 18 99 86 103 73 114 101 130 87 132 111 143 71 158 146 162 57 172 104 190 169 198 38 205 152 212 124 223 39 236 228 247 55 256 119 264 109 280 55 288 111 293 144 310 181 311 51 321 112 337 176 344 207 352 304 370 85 376 60 390 232 394 196 40...
output:
827862893
result:
ok 1 number(s): "827862893"
Test #61:
score: 0
Accepted
time: 10ms
memory: 5128kb
input:
10000 23855 10 1 2 1 8 1 14 1 28 1 42 1 46 1 53 1 65 1 74 1 88 1 94 1 111 1 113 1 127 1 138 1 151 1 159 1 167 1 173 1 191 1 201 1 210 1 214 1 229 1 233 1 243 1 255 1 271 1 279 1 284 1 293 1 309 1 321 1 327 1 334 1 349 1 358 1 370 1 375 1 390 1 399 1 412 1 413 1 429 1 436 1 449 1 456 1 467 1 479 1 48...
output:
912079865
result:
ok 1 number(s): "912079865"
Test #62:
score: 0
Accepted
time: 12ms
memory: 5520kb
input:
10000 45984 10 1 2 1 6 1 19 1 26 1 41 1 48 1 62 1 65 1 81 1 88 1 95 1 109 1 120 1 132 1 141 1 145 1 153 1 167 1 174 1 185 1 202 1 208 1 213 1 225 1 238 1 250 1 255 1 265 1 281 1 292 1 300 1 305 1 314 1 323 1 339 1 352 1 358 1 365 1 375 1 388 1 395 1 412 1 417 1 425 1 442 1 446 1 458 1 472 1 478 1 48...
output:
857484436
result:
ok 1 number(s): "857484436"
Test #63:
score: 0
Accepted
time: 15ms
memory: 6140kb
input:
10000 35661 15 1 27 10 33 29 57 37 65 23 85 3 92 20 115 9 125 102 140 86 152 48 173 43 182 44 204 99 218 160 238 187 253 197 261 180 277 113 292 268 308 313 325 153 331 75 352 254 362 360 378 265 391 365 419 249 432 365 450 166 464 298 472 43 484 89 497 316 516 28 534 96 546 486 563 472 581 459 586 ...
output:
570517181
result:
ok 1 number(s): "570517181"
Test #64:
score: 0
Accepted
time: 14ms
memory: 6304kb
input:
10000 70641 15 11 18 9 31 12 52 12 74 27 84 21 98 4 119 42 123 34 136 36 152 86 170 154 190 138 201 177 212 89 226 130 243 214 265 245 281 152 293 271 310 106 316 253 333 93 351 102 369 198 381 131 398 241 408 260 435 365 441 45 454 254 473 353 483 375 499 408 514 411 537 6 552 547 562 476 572 552 5...
output:
162805514
result:
ok 1 number(s): "162805514"
Test #65:
score: 0
Accepted
time: 14ms
memory: 5300kb
input:
10000 35807 15 1 2 1 12 1 20 1 47 1 48 1 63 1 88 1 103 1 113 1 130 1 139 1 159 1 171 1 183 1 206 1 226 1 229 1 249 1 262 1 282 1 298 1 313 1 330 1 342 1 353 1 369 1 387 1 398 1 411 1 430 1 445 1 466 1 473 1 484 1 511 1 521 1 542 1 546 1 567 1 575 1 599 1 608 1 632 1 635 1 657 1 665 1 692 1 703 1 721...
output:
202092463
result:
ok 1 number(s): "202092463"
Test #66:
score: 0
Accepted
time: 12ms
memory: 5556kb
input:
10000 70626 15 1 2 1 12 1 30 1 40 1 53 1 76 1 83 1 94 1 110 1 136 1 150 1 159 1 169 1 187 1 209 1 216 1 233 1 248 1 263 1 284 1 288 1 313 1 329 1 333 1 362 1 376 1 378 1 401 1 418 1 434 1 446 1 456 1 482 1 497 1 508 1 520 1 536 1 545 1 566 1 586 1 597 1 617 1 632 1 640 1 659 1 673 1 685 1 693 1 720 ...
output:
243439222
result:
ok 1 number(s): "243439222"
Test #67:
score: 0
Accepted
time: 23ms
memory: 6624kb
input:
10000 60498 25 6 38 40 66 35 80 27 125 57 130 17 160 91 191 110 217 219 227 57 267 120 282 285 317 185 332 141 359 211 399 294 417 80 443 142 451 317 481 331 506 461 539 426 566 275 600 596 614 187 635 602 675 387 682 73 707 190 749 405 757 679 790 289 812 527 828 387 856 536 900 232 908 721 935 255...
output:
375019948
result:
ok 1 number(s): "375019948"
Test #68:
score: 0
Accepted
time: 25ms
memory: 7412kb
input:
10000 120399 25 4 41 27 68 73 86 96 101 73 132 143 168 65 193 165 221 127 245 199 263 69 294 94 318 6 348 159 370 116 395 155 403 343 432 39 458 377 493 374 522 128 528 107 556 320 599 528 601 574 635 354 658 178 687 554 706 183 746 572 751 45 781 2 806 179 845 581 855 319 898 76 925 42 939 277 964 ...
output:
673544843
result:
ok 1 number(s): "673544843"
Test #69:
score: 0
Accepted
time: 19ms
memory: 5620kb
input:
10000 60404 25 1 2 1 11 1 49 1 66 1 88 1 113 1 142 1 172 1 202 1 217 1 233 1 266 1 280 1 304 1 342 1 361 1 389 1 406 1 439 1 459 1 484 1 515 1 548 1 576 1 593 1 608 1 631 1 663 1 689 1 718 1 738 1 769 1 779 1 818 1 830 1 874 1 898 1 919 1 942 1 953 1 987 1 1020 1 1042 1 1063 1 1084 1 1115 1 1133 1 1...
output:
476255525
result:
ok 1 number(s): "476255525"
Test #70:
score: 0
Accepted
time: 28ms
memory: 6512kb
input:
10000 120354 25 1 2 1 13 1 33 1 59 1 86 1 113 1 133 1 176 1 198 1 220 1 228 1 274 1 297 1 318 1 331 1 376 1 381 1 427 1 451 1 475 1 498 1 523 1 547 1 558 1 593 1 620 1 632 1 662 1 678 1 712 1 749 1 759 1 800 1 818 1 840 1 862 1 886 1 927 1 933 1 970 1 981 1 1013 1 1040 1 1068 1 1084 1 1107 1 1149 1 ...
output:
283903302
result:
ok 1 number(s): "283903302"
Test #71:
score: 0
Accepted
time: 6ms
memory: 5948kb
input:
25000 24999 1 1 2 2 3 3 4 2 5 5 6 3 7 1 8 4 9 8 10 1 11 7 12 6 13 10 14 2 15 11 16 6 17 16 18 11 19 4 20 15 21 21 22 22 23 8 24 9 25 24 26 20 27 21 28 26 29 24 30 22 31 7 32 13 33 8 34 20 35 24 36 29 37 32 38 11 39 3 40 32 41 8 42 18 43 22 44 14 45 35 46 4 47 7 48 34 49 10 50 10 51 1 52 18 53 47 54 ...
output:
0
result:
ok 1 number(s): "0"
Test #72:
score: 0
Accepted
time: 13ms
memory: 5996kb
input:
25000 24999 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60...
output:
0
result:
ok 1 number(s): "0"
Test #73:
score: 0
Accepted
time: 14ms
memory: 6016kb
input:
25000 33332 3 3 4 3 7 4 11 6 14 14 16 7 19 3 24 20 26 9 29 12 32 29 35 7 38 4 42 42 44 10 47 39 49 14 52 33 55 19 58 51 62 19 65 35 68 67 72 56 74 6 78 36 79 18 84 80 85 42 90 82 93 30 95 20 98 38 100 65 104 6 108 89 111 107 113 111 117 107 119 25 121 109 124 98 129 33 132 8 133 28 138 116 139 97 14...
output:
0
result:
ok 1 number(s): "0"
Test #74:
score: 0
Accepted
time: 18ms
memory: 6112kb
input:
25000 33332 3 1 4 5 8 2 12 10 13 14 18 17 20 8 23 2 25 23 30 3 31 31 35 24 37 10 40 2 44 42 47 27 49 40 53 8 57 47 58 5 62 41 66 28 68 32 71 25 75 51 77 7 80 74 83 80 85 30 90 12 92 31 96 84 97 72 102 35 103 82 106 60 109 26 112 113 116 33 120 65 122 68 126 27 127 96 131 37 133 107 137 112 140 30 14...
output:
0
result:
ok 1 number(s): "0"
Test #75:
score: 0
Accepted
time: 17ms
memory: 5936kb
input:
25000 33331 3 1 2 1 5 1 7 1 10 1 12 1 16 1 18 1 22 1 26 1 29 1 30 1 33 1 36 1 40 1 43 1 46 1 48 1 51 1 54 1 58 1 62 1 64 1 68 1 70 1 72 1 75 1 80 1 81 1 84 1 88 1 92 1 93 1 98 1 99 1 103 1 105 1 109 1 111 1 116 1 117 1 122 1 124 1 126 1 131 1 134 1 136 1 138 1 142 1 146 1 147 1 151 1 153 1 157 1 160...
output:
175532123
result:
ok 1 number(s): "175532123"
Test #76:
score: 0
Accepted
time: 16ms
memory: 5932kb
input:
25000 33331 3 1 2 1 3 1 8 1 10 1 12 1 16 1 18 1 22 1 25 1 28 1 32 1 35 1 38 1 40 1 43 1 45 1 49 1 51 1 55 1 57 1 62 1 64 1 66 1 70 1 73 1 76 1 79 1 83 1 85 1 88 1 90 1 93 1 96 1 100 1 104 1 107 1 110 1 111 1 116 1 117 1 122 1 125 1 126 1 131 1 132 1 137 1 139 1 141 1 144 1 148 1 151 1 155 1 157 1 15...
output:
175532123
result:
ok 1 number(s): "175532123"
Test #77:
score: 0
Accepted
time: 21ms
memory: 6372kb
input:
25000 44134 7 2 14 7 18 3 25 23 31 4 36 7 44 32 54 26 61 49 66 6 75 50 81 43 87 48 93 73 100 77 107 74 118 103 123 125 127 124 135 8 142 36 152 145 159 144 166 38 171 138 177 105 187 58 193 56 201 152 208 65 216 24 220 190 229 19 237 82 244 80 247 202 254 6 261 67 271 223 275 25 282 278 294 107 299 ...
output:
0
result:
ok 1 number(s): "0"
Test #78:
score: 0
Accepted
time: 24ms
memory: 6760kb
input:
25000 78565 7 3 10 5 18 3 28 12 35 3 39 12 43 30 50 39 58 51 64 13 73 57 79 15 89 67 98 80 102 100 108 44 117 48 121 92 127 13 136 131 147 88 151 2 159 156 168 134 171 67 182 33 185 4 190 191 203 42 204 116 212 30 221 117 227 151 238 189 243 133 249 127 257 75 265 196 273 266 279 166 281 235 291 230...
output:
911611963
result:
ok 1 number(s): "911611963"
Test #79:
score: 0
Accepted
time: 20ms
memory: 5972kb
input:
25000 44346 7 1 2 1 9 1 15 1 19 1 25 1 32 1 44 1 48 1 54 1 61 1 67 1 77 1 83 1 91 1 99 1 103 1 109 1 119 1 122 1 133 1 138 1 147 1 156 1 160 1 168 1 177 1 181 1 191 1 196 1 199 1 210 1 214 1 222 1 230 1 237 1 244 1 248 1 255 1 262 1 275 1 277 1 285 1 291 1 298 1 309 1 311 1 324 1 329 1 336 1 341 1 3...
output:
0
result:
ok 1 number(s): "0"
Test #80:
score: 0
Accepted
time: 19ms
memory: 6368kb
input:
25000 78564 7 1 2 1 5 1 15 1 20 1 29 1 32 1 43 1 45 1 52 1 65 1 68 1 78 1 86 1 92 1 97 1 105 1 113 1 118 1 126 1 130 1 140 1 145 1 154 1 158 1 168 1 173 1 184 1 186 1 197 1 199 1 212 1 215 1 223 1 227 1 240 1 246 1 252 1 260 1 265 1 274 1 280 1 288 1 290 1 303 1 310 1 315 1 321 1 330 1 335 1 342 1 3...
output:
0
result:
ok 1 number(s): "0"
Test #81:
score: 0
Accepted
time: 22ms
memory: 6908kb
input:
25000 59314 10 1 18 4 28 21 34 11 44 35 58 50 66 44 75 40 87 80 100 31 106 7 113 36 127 78 136 80 150 82 159 46 169 66 180 54 182 12 200 174 202 17 217 140 225 35 231 145 246 239 255 259 265 5 274 19 289 160 297 248 310 297 315 207 323 137 336 26 344 330 356 192 361 66 375 139 387 178 394 333 410 38...
output:
0
result:
ok 1 number(s): "0"
Test #82:
score: 0
Accepted
time: 33ms
memory: 7976kb
input:
25000 114999 10 1 17 3 25 25 32 35 41 37 53 12 68 38 74 60 87 32 91 49 107 59 114 79 127 67 134 45 143 116 152 7 163 162 173 119 182 176 191 109 208 91 212 191 230 64 232 210 242 135 254 159 262 201 278 175 289 282 299 168 302 308 312 96 329 328 338 169 346 237 354 93 364 107 372 131 387 63 398 211 ...
output:
167528799
result:
ok 1 number(s): "167528799"
Test #83:
score: 0
Accepted
time: 24ms
memory: 6132kb
input:
25000 59388 10 1 2 1 7 1 22 1 26 1 38 1 51 1 57 1 63 1 76 1 91 1 94 1 111 1 114 1 125 1 142 1 150 1 160 1 169 1 176 1 185 1 202 1 210 1 215 1 228 1 241 1 243 1 256 1 264 1 274 1 284 1 297 1 307 1 317 1 329 1 333 1 343 1 362 1 366 1 379 1 390 1 393 1 409 1 414 1 425 1 442 1 451 1 455 1 467 1 478 1 48...
output:
895138572
result:
ok 1 number(s): "895138572"
Test #84:
score: 0
Accepted
time: 30ms
memory: 7340kb
input:
25000 114984 10 1 2 1 4 1 17 1 30 1 37 1 43 1 55 1 72 1 73 1 89 1 93 1 104 1 116 1 127 1 141 1 146 1 156 1 164 1 177 1 191 1 201 1 205 1 216 1 229 1 237 1 246 1 257 1 270 1 276 1 283 1 298 1 305 1 319 1 324 1 339 1 346 1 358 1 371 1 379 1 383 1 394 1 407 1 422 1 430 1 434 1 452 1 455 1 463 1 477 1 4...
output:
321722057
result:
ok 1 number(s): "321722057"
Test #85:
score: 0
Accepted
time: 31ms
memory: 7664kb
input:
25000 89337 15 7 30 3 43 27 46 39 68 29 81 7 98 56 110 91 127 82 145 114 155 65 168 166 186 150 203 49 219 201 232 219 249 111 256 172 272 201 293 185 309 271 329 50 335 229 347 331 368 35 389 344 402 172 407 29 427 389 450 104 453 420 475 99 492 459 507 24 525 61 537 324 554 177 566 287 572 184 595...
output:
473674440
result:
ok 1 number(s): "473674440"
Test #86:
score: 0
Accepted
time: 43ms
memory: 8120kb
input:
25000 176641 15 1 21 9 35 9 56 28 63 57 85 57 102 77 113 10 126 104 142 124 161 36 180 51 181 110 201 158 214 145 236 145 253 249 258 207 278 269 287 256 303 4 318 8 342 98 353 315 361 263 384 255 393 130 411 24 432 380 442 194 464 423 468 408 492 131 509 107 524 459 526 108 553 224 566 216 577 150 ...
output:
340738125
result:
ok 1 number(s): "340738125"
Test #87:
score: 0
Accepted
time: 30ms
memory: 6448kb
input:
25000 89358 15 1 2 1 7 1 24 1 34 1 51 1 69 1 82 1 106 1 111 1 124 1 148 1 155 1 177 1 193 1 201 1 215 1 229 1 245 1 270 1 285 1 293 1 316 1 326 1 340 1 357 1 370 1 390 1 393 1 412 1 433 1 448 1 460 1 469 1 494 1 507 1 522 1 530 1 553 1 561 1 576 1 602 1 614 1 619 1 645 1 648 1 663 1 687 1 698 1 712 ...
output:
767269277
result:
ok 1 number(s): "767269277"
Test #88:
score: 0
Accepted
time: 33ms
memory: 7120kb
input:
25000 176626 15 1 2 1 14 1 19 1 43 1 49 1 66 1 85 1 104 1 122 1 129 1 138 1 164 1 174 1 188 1 205 1 219 1 234 1 250 1 270 1 278 1 298 1 316 1 332 1 347 1 352 1 363 1 380 1 397 1 419 1 436 1 441 1 458 1 478 1 492 1 511 1 520 1 539 1 551 1 560 1 587 1 601 1 608 1 632 1 637 1 648 1 670 1 687 1 704 1 71...
output:
646994674
result:
ok 1 number(s): "646994674"
Test #89:
score: 0
Accepted
time: 58ms
memory: 8880kb
input:
25000 150860 25 5 26 46 59 68 84 68 125 76 144 132 165 134 194 73 220 179 245 66 256 231 286 208 314 20 342 307 361 286 383 310 403 370 449 52 451 44 488 97 522 224 535 139 553 26 599 535 619 297 643 512 657 194 685 357 717 611 733 652 763 222 795 398 821 333 849 614 870 607 892 715 921 918 928 930 ...
output:
72814810
result:
ok 1 number(s): "72814810"
Test #90:
score: 0
Accepted
time: 68ms
memory: 9728kb
input:
25000 300999 25 25 34 8 53 6 89 8 115 59 130 58 173 112 193 108 224 221 237 82 259 177 298 21 318 94 350 250 359 216 397 201 418 191 442 71 455 116 479 119 501 487 549 299 568 324 590 280 609 134 636 268 652 2 682 459 716 200 726 427 757 238 781 107 819 810 845 113 869 102 885 564 905 239 928 803 96...
output:
415326494
result:
ok 1 number(s): "415326494"
Test #91:
score: 0
Accepted
time: 57ms
memory: 7428kb
input:
25000 150936 25 1 2 1 8 1 52 1 66 1 90 1 119 1 146 1 154 1 202 1 213 1 245 1 271 1 286 1 310 1 347 1 359 1 399 1 407 1 438 1 476 1 484 1 520 1 548 1 572 1 593 1 611 1 634 1 673 1 699 1 721 1 742 1 753 1 779 1 807 1 839 1 854 1 895 1 911 1 947 1 968 1 1001 1 1025 1 1043 1 1064 1 1099 1 1103 1 1138 1 ...
output:
44507134
result:
ok 1 number(s): "44507134"
Test #92:
score: 0
Accepted
time: 66ms
memory: 8792kb
input:
25000 300954 25 1 2 1 23 1 33 1 56 1 88 1 119 1 144 1 158 1 190 1 208 1 236 1 271 1 299 1 307 1 340 1 374 1 388 1 427 1 429 1 455 1 494 1 510 1 539 1 558 1 593 1 623 1 652 1 668 1 687 1 715 1 750 1 755 1 788 1 807 1 840 1 863 1 896 1 923 1 950 1 957 1 995 1 1019 1 1037 1 1070 1 1099 1 1103 1 1133 1 ...
output:
897842117
result:
ok 1 number(s): "897842117"
Test #93:
score: 0
Accepted
time: 1ms
memory: 4492kb
input:
1 0 25
output:
0
result:
ok 1 number(s): "0"
Test #94:
score: 0
Accepted
time: 1ms
memory: 4716kb
input:
2 1 25 1 2
output:
998244352
result:
ok 1 number(s): "998244352"
Test #95:
score: 0
Accepted
time: 1ms
memory: 4416kb
input:
3 3 25 1 2 1 3 2 3
output:
2
result:
ok 1 number(s): "2"
Test #96:
score: 0
Accepted
time: 1ms
memory: 4688kb
input:
4 4 25 1 2 1 3 1 4 2 3
output:
1
result:
ok 1 number(s): "1"
Test #97:
score: 0
Accepted
time: 1ms
memory: 4436kb
input:
5 7 25 1 2 1 3 1 4 1 5 2 4 2 5 3 5
output:
998244351
result:
ok 1 number(s): "998244351"
Test #98:
score: 0
Accepted
time: 1ms
memory: 4532kb
input:
6 11 25 1 2 1 3 1 5 1 6 2 3 2 4 2 5 2 6 3 5 4 5 4 6
output:
0
result:
ok 1 number(s): "0"
Test #99:
score: 0
Accepted
time: 1ms
memory: 4404kb
input:
7 14 25 1 2 1 4 1 7 2 3 2 4 2 5 3 5 3 6 3 7 4 5 4 7 5 6 5 7 6 7
output:
2
result:
ok 1 number(s): "2"
Test #100:
score: 0
Accepted
time: 1ms
memory: 4448kb
input:
8 17 25 1 2 1 3 1 5 1 6 1 7 2 4 2 5 2 6 2 7 2 8 3 4 3 7 4 5 4 6 4 8 5 7 5 8
output:
4
result:
ok 1 number(s): "4"
Test #101:
score: 0
Accepted
time: 1ms
memory: 4500kb
input:
9 25 25 1 2 1 3 1 4 1 5 1 6 1 7 1 8 2 3 2 4 2 6 2 8 2 9 3 5 3 6 3 8 3 9 4 6 4 7 4 8 5 6 5 8 5 9 6 7 7 9 8 9
output:
998244351
result:
ok 1 number(s): "998244351"
Test #102:
score: 0
Accepted
time: 1ms
memory: 4480kb
input:
10 26 25 1 2 1 6 2 3 2 5 2 6 2 7 2 8 2 9 2 10 3 4 3 5 3 7 3 8 3 9 4 6 4 7 4 8 4 9 5 6 5 8 6 8 6 9 7 8 7 9 8 10 9 10
output:
0
result:
ok 1 number(s): "0"
Test #103:
score: 0
Accepted
time: 1ms
memory: 4544kb
input:
11 35 25 1 2 1 3 1 5 1 6 1 7 1 10 2 4 2 5 2 8 2 10 2 11 3 4 3 6 3 7 3 9 3 10 3 11 4 5 4 6 4 7 4 9 4 10 5 6 5 7 5 8 5 10 6 7 7 8 7 10 7 11 8 9 8 11 9 10 9 11 10 11
output:
18
result:
ok 1 number(s): "18"
Test #104:
score: 0
Accepted
time: 1ms
memory: 4792kb
input:
12 36 25 1 2 1 3 1 7 1 9 1 10 2 4 2 5 2 6 2 7 2 9 2 10 2 12 3 4 3 5 3 8 3 10 3 12 4 7 4 8 4 10 4 12 5 6 5 8 5 9 5 10 6 7 6 10 6 11 7 9 7 11 8 10 8 11 8 12 9 12 10 12 11 12
output:
8
result:
ok 1 number(s): "8"
Test #105:
score: 0
Accepted
time: 1ms
memory: 4528kb
input:
13 50 25 1 2 1 3 1 4 1 5 1 6 1 8 1 10 1 11 1 12 2 7 2 11 2 12 2 13 3 4 3 5 3 6 3 8 3 9 3 11 3 12 4 5 4 7 4 8 4 11 4 13 5 9 5 10 5 11 5 12 5 13 6 7 6 8 6 9 6 10 6 11 7 8 7 10 7 12 7 13 8 9 8 10 8 12 8 13 9 10 9 12 10 11 10 12 10 13 11 12 11 13
output:
998244297
result:
ok 1 number(s): "998244297"
Test #106:
score: 0
Accepted
time: 1ms
memory: 4516kb
input:
14 48 25 1 2 1 6 1 7 1 8 1 9 1 11 1 13 2 3 2 4 2 5 2 10 3 4 3 5 3 6 3 7 3 8 3 10 3 14 4 6 4 7 4 8 4 9 4 12 4 14 5 6 5 10 6 7 6 8 6 9 6 10 6 11 6 14 7 8 7 9 7 11 7 12 7 14 8 11 8 12 8 13 8 14 9 10 9 11 10 12 10 14 11 13 11 14 13 14
output:
52
result:
ok 1 number(s): "52"
Test #107:
score: 0
Accepted
time: 1ms
memory: 4588kb
input:
15 60 25 1 2 1 3 1 5 1 6 1 7 1 9 1 11 1 14 2 3 2 6 2 7 2 9 2 12 3 4 3 5 3 7 3 8 3 9 3 11 3 12 3 13 3 14 3 15 4 7 4 9 4 10 4 12 4 13 4 14 5 6 5 7 5 8 5 9 5 10 5 11 5 12 5 13 6 8 6 9 6 11 6 12 7 9 7 10 7 11 7 13 7 15 8 11 8 12 8 13 9 14 10 11 10 14 11 12 11 13 11 14 11 15 12 13 12 14 13 15 14 15
output:
998243723
result:
ok 1 number(s): "998243723"
Test #108:
score: 0
Accepted
time: 1ms
memory: 4520kb
input:
16 64 25 1 2 1 3 1 4 1 5 1 8 1 11 1 12 1 14 2 3 2 4 2 5 2 7 2 8 2 11 2 12 2 15 2 16 3 5 3 6 3 8 3 10 3 11 3 15 4 6 4 7 4 12 4 13 4 15 4 16 5 6 5 7 5 9 5 11 5 12 5 13 5 14 5 16 6 8 6 10 6 12 6 13 6 14 7 8 7 9 7 10 7 11 7 14 8 13 8 16 9 11 9 12 9 13 10 15 11 12 11 13 11 16 12 14 12 15 12 16 13 14 13 1...
output:
4
result:
ok 1 number(s): "4"
Test #109:
score: 0
Accepted
time: 1ms
memory: 4576kb
input:
17 81 25 1 2 1 3 1 5 1 6 1 7 1 8 1 9 1 11 1 12 1 14 1 15 1 16 1 17 2 4 2 6 2 8 2 9 2 10 2 11 2 14 2 15 3 5 3 7 3 9 3 12 3 13 3 14 4 5 4 6 4 10 4 11 4 13 4 14 4 17 5 6 5 7 5 8 5 10 5 11 5 12 5 13 5 15 5 16 5 17 6 8 6 10 6 11 6 12 6 14 6 17 7 8 7 11 7 13 7 17 8 9 8 10 8 13 8 17 9 10 9 14 9 15 10 12 10...
output:
90
result:
ok 1 number(s): "90"
Test #110:
score: 0
Accepted
time: 1ms
memory: 4504kb
input:
18 87 25 1 2 1 3 1 5 1 6 1 9 1 10 1 12 1 13 1 14 1 15 1 17 1 18 2 3 2 4 2 5 2 8 2 10 2 11 2 12 2 17 2 18 3 7 3 12 3 14 3 16 3 18 4 5 4 6 4 7 4 9 4 12 4 13 4 17 5 6 5 7 5 8 5 9 5 10 5 12 5 14 5 15 5 17 6 7 6 9 6 11 6 13 6 18 7 9 7 10 7 13 7 15 7 17 8 10 8 11 8 12 8 13 8 14 8 15 8 17 9 11 9 14 9 15 9 ...
output:
308
result:
ok 1 number(s): "308"
Test #111:
score: 0
Accepted
time: 1ms
memory: 4808kb
input:
19 96 25 1 2 1 4 1 9 1 10 1 12 1 13 1 14 1 17 1 19 2 3 2 4 2 5 2 6 2 7 2 8 2 13 2 15 3 4 3 6 3 7 3 8 3 9 3 10 3 16 3 19 4 5 4 6 4 7 4 9 4 10 4 11 4 13 4 14 4 17 4 18 4 19 5 6 5 7 5 10 5 12 5 14 5 15 5 18 6 8 6 9 6 11 6 13 6 15 6 16 6 17 6 18 7 8 7 10 7 12 7 13 7 15 7 16 7 18 8 9 8 12 8 16 8 19 9 10 ...
output:
1930
result:
ok 1 number(s): "1930"
Test #112:
score: 0
Accepted
time: 1ms
memory: 4852kb
input:
20 102 25 1 2 1 3 1 4 1 8 1 10 1 11 1 12 1 13 1 15 1 16 1 19 2 3 2 4 2 5 2 7 2 9 2 14 2 15 2 16 2 18 2 20 3 4 3 5 3 11 3 14 3 15 3 18 4 5 4 8 4 9 4 12 4 13 4 14 4 15 4 17 4 18 4 19 4 20 5 6 5 7 5 11 5 16 5 17 5 18 5 19 5 20 6 7 6 9 6 12 6 13 6 16 6 17 6 18 6 19 7 8 7 11 7 16 7 17 7 18 7 19 8 10 8 11...
output:
2456
result:
ok 1 number(s): "2456"
Test #113:
score: 0
Accepted
time: 1ms
memory: 4848kb
input:
21 118 25 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 10 1 11 1 12 1 13 1 15 1 16 1 18 1 19 1 21 2 3 2 9 2 11 2 12 2 13 2 15 2 16 2 17 2 18 2 21 3 4 3 5 3 6 3 7 3 9 3 10 3 12 3 13 3 17 3 18 3 19 3 20 3 21 4 6 4 9 4 11 4 12 4 13 4 14 4 15 4 17 4 18 4 19 4 20 4 21 5 9 5 11 5 13 5 19 6 7 6 8 6 10 6 13 6 17 6 19 6 20...
output:
998242987
result:
ok 1 number(s): "998242987"
Test #114:
score: 0
Accepted
time: 1ms
memory: 4568kb
input:
22 121 25 1 2 1 3 1 4 1 6 1 8 1 9 1 11 1 12 1 13 1 14 1 16 1 17 1 19 1 20 1 22 2 3 2 4 2 6 2 7 2 11 2 17 2 18 2 20 3 4 3 5 3 8 3 13 3 15 3 17 3 18 3 19 3 22 4 7 4 8 4 9 4 10 4 14 4 15 4 16 4 18 4 19 5 6 5 7 5 8 5 9 5 10 5 11 5 13 5 15 5 16 5 18 6 7 6 8 6 9 6 10 6 13 6 14 6 15 6 17 7 8 7 11 7 12 7 13...
output:
998239409
result:
ok 1 number(s): "998239409"
Test #115:
score: 0
Accepted
time: 1ms
memory: 4576kb
input:
23 136 25 1 2 1 3 1 4 1 5 1 6 1 11 1 15 1 17 1 18 1 19 1 20 1 21 1 23 2 3 2 4 2 5 2 8 2 9 2 11 2 15 2 17 2 18 2 23 3 4 3 7 3 9 3 10 3 11 3 14 3 15 3 17 3 19 3 22 4 5 4 8 4 9 4 10 4 12 4 13 4 15 4 20 4 21 5 6 5 7 5 9 5 10 5 11 5 14 5 15 5 16 5 17 5 19 5 20 5 21 5 23 6 7 6 8 6 11 6 14 6 15 6 18 6 19 7...
output:
998242801
result:
ok 1 number(s): "998242801"
Test #116:
score: 0
Accepted
time: 1ms
memory: 4596kb
input:
24 146 25 1 2 1 3 1 4 1 6 1 11 1 13 1 14 1 18 1 21 1 22 1 24 2 5 2 10 2 12 2 14 2 16 2 17 2 18 2 19 2 22 2 23 3 6 3 7 3 10 3 11 3 12 3 13 3 15 3 18 3 19 3 20 3 21 3 23 3 24 4 5 4 6 4 8 4 11 4 12 4 13 4 16 4 17 4 18 4 19 4 22 4 24 5 7 5 8 5 9 5 13 5 16 5 17 5 18 5 19 5 20 5 22 5 23 6 7 6 9 6 10 6 13 ...
output:
997987893
result:
ok 1 number(s): "997987893"
Test #117:
score: 0
Accepted
time: 1ms
memory: 4576kb
input:
25 159 25 1 2 1 4 1 7 1 8 1 10 1 12 1 13 1 14 1 17 1 22 2 3 2 8 2 9 2 10 2 11 2 13 2 14 2 22 2 23 2 25 3 5 3 8 3 9 3 11 3 15 3 18 3 20 3 21 3 23 3 24 4 5 4 6 4 7 4 8 4 12 4 13 4 18 4 19 4 20 4 21 4 22 4 24 5 7 5 8 5 11 5 12 5 14 5 15 5 16 5 17 5 18 5 19 5 20 5 21 5 22 5 23 5 24 5 25 6 7 6 8 6 9 6 11...
output:
107366
result:
ok 1 number(s): "107366"