QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#358958 | #6325. Peaceful Results | 275307894a | AC ✓ | 594ms | 207744kb | C++14 | 3.6kb | 2024-03-20 09:53:48 | 2024-03-20 09:53:48 |
Judging History
answer
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=1.5e6+5,M=(1<<22)+5,K=1000+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(263082);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
#ifdef LOCAL
#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
#else
#define gdb(...) void()
#endif
}using namespace Debug;
int n,Ar,Ap,As,Br,Bp,Bs,Cr,Cp,Cs;
ll frc[N],inv[N],A[M],B[M],C[M];
int k;
ll mpow(ll x,int y=mod-2){ll ans=1;while(y) y&1&&(ans=ans*x%mod),y>>=1,x=x*x%mod;return ans;}
namespace poly{
int tr[M];ll pw[M];const int g=3,Ig=mpow(g);
void init(int n){
k=0;for(k=1;k<=n;k<<=1);
for(int i=0;i<k;i++) tr[i]=(tr[i>>1]>>1)|((i&1)?k/2:0);
ll w=mpow(g,(mod-1)/k);
pw[k/2]=1;for(int i=k/2+1;i<k;i++) pw[i]=pw[i-1]*w%mod;
for(int i=k/2-1;i;i--) pw[i]=pw[i<<1];
}
void NTT(ll *A,int k,int flag){
static ull a[M];
int i,j,h;for(int i=0;i<k;i++) a[tr[i]]=A[i];
for(int i=2;i<=k;i<<=1){
ll *e=pw+i/2;
for(int j=0;j<k;j+=i){
for(int h=j;h<j+i/2;h++) {
ll now=e[h-j]*a[h+i/2]%mod;
a[h+i/2]=a[h]+mod-now;
a[h]+=now;
}
}
if(i==(1<<18)){for(int j=0;j<k;j++) a[j]%=mod;}
}
for(int i=0;i<k;i++) A[i]=a[i]%mod;
if(flag) return;
ll iv=mpow(k);for(int i=0;i<k;i++) A[i]=A[i]*iv%mod;
reverse(A+1,A+k);
}
}
void convolute(ll *A,ll *B,ll *C){
poly::init(2*(n+1));
poly::NTT(A,k,1);poly::NTT(B,k,1);
for(int i=0;i<k;i++) C[i]=A[i]*B[i]%mod;
poly::NTT(C,k,0);
// for(int i=0;i<=n;i++) if(A[i]) for(int j=0;j<=n;j++) if(B[j]) C[i+j]=(C[i+j]+A[i]*B[j])%mod;
}
void Solve(){
int i,j;scanf("%d%d%d%d%d%d%d%d%d%d",&n,&Ar,&Ap,&As,&Br,&Bp,&Bs,&Cr,&Cp,&Cs);
inv[1]=1;for(i=2;i<=n;i++) inv[i]=(mod-inv[mod%i])*(mod/i)%mod;
for(inv[0]=frc[0]=i=1;i<=n;i++) inv[i]=inv[i-1]*inv[i]%mod,frc[i]=frc[i-1]*i%mod;
ll ans=0;
for(int x1=0;x1<=n;x1++){
if(x1>Ar||x1>Br||x1>Cr) continue;
int x4=Ar+Br+Cr-3*x1-Ap-Bp-Cp;
if(x4%3) continue;x4/=-3;
if(x4<0||x4>Ap||x4>Bp||x4>Cp) continue;
int x7=Ar+Br+Cr-3*x1-As-Bs-Cs;
if(x7%3) continue;x7/=-3;
if(x7<0||x7>As||x7>Bs||x7>Cs) continue;
A[x1]=inv[x1]*inv[x4]%mod*inv[x7]%mod;
gdb(x1,A[x1]);
}
for(int x2=0;x2<=n;x2++){
if(x2>Ar||x2>Bp||x2>Cs) continue;
int x5=Ar+Bp+Cs-3*x2-Ap-Bs-Cr;
if(x5%3) continue;x5/=-3;
if(x5<0||x5>Ap||x5>Bs||x5>Cr) continue;
int x8=Ar+Bp+Cs-3*x2-As-Br-Cp;
if(x8%3) continue;x8/=-3;
if(x8<0||x8>As||x8>Br||x8>Cp) continue;
B[x2]=inv[x2]*inv[x5]%mod*inv[x8]%mod;
gdb(x2,B[x2]);
}
convolute(A,B,C);
for(int xs=0;xs<=2*n;xs++){
int x3=Ar-xs;
if(x3<0||x3>Ar||x3>Bs||x3>Cp) continue;
int x6=Ar+Bs+Cp-3*x3-Ap-Br-Cs;
if(x6%3) continue;x6/=-3;
if(x6<0||x6>Ap||x6>Br||x6>Cs) continue;
int x9=Ar+Bs+Cp-3*x3-As-Bp-Cr;
if(x9%3) continue;x9/=-3;
if(x9<0||x9>As||x9>Bp||x9>Cr) continue;
ans+=C[xs]*inv[x3]%mod*inv[x6]%mod*inv[x9]%mod;
}
printf("%lld\n",ans%mod*frc[n]%mod);
}
int main(){
int t=1;
// scanf("%d",&t);
while(t--) Solve();
cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 16268kb
input:
2 2 0 0 1 1 0 1 0 1
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 2ms
memory: 12244kb
input:
3 0 1 2 3 0 0 1 1 1
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 91ms
memory: 65428kb
input:
333333 111111 111111 111111 111111 111111 111111 111111 111111 111111
output:
383902959
result:
ok 1 number(s): "383902959"
Test #4:
score: 0
Accepted
time: 534ms
memory: 207648kb
input:
1500000 500000 500000 500000 500000 500000 500000 500000 500000 500000
output:
355543262
result:
ok 1 number(s): "355543262"
Test #5:
score: 0
Accepted
time: 523ms
memory: 207696kb
input:
1499999 499999 499999 500001 499999 499999 500001 499999 499999 500001
output:
934301164
result:
ok 1 number(s): "934301164"
Test #6:
score: 0
Accepted
time: 528ms
memory: 207584kb
input:
1500000 1 0 1499999 1499999 1 0 0 1499999 1
output:
1500000
result:
ok 1 number(s): "1500000"
Test #7:
score: 0
Accepted
time: 521ms
memory: 207696kb
input:
1499999 0 749999 750000 750000 0 749999 749999 750000 0
output:
713966599
result:
ok 1 number(s): "713966599"
Test #8:
score: 0
Accepted
time: 0ms
memory: 16340kb
input:
1 1 0 0 0 0 1 0 1 0
output:
1
result:
ok 1 number(s): "1"
Test #9:
score: 0
Accepted
time: 0ms
memory: 16324kb
input:
1 0 1 0 0 1 0 0 1 0
output:
1
result:
ok 1 number(s): "1"
Test #10:
score: 0
Accepted
time: 1ms
memory: 12228kb
input:
1 0 0 1 1 0 0 1 0 0
output:
0
result:
ok 1 number(s): "0"
Test #11:
score: 0
Accepted
time: 536ms
memory: 207700kb
input:
1499999 500000 500000 499999 499999 499999 500001 499999 499999 500001
output:
617065435
result:
ok 1 number(s): "617065435"
Test #12:
score: 0
Accepted
time: 2ms
memory: 12248kb
input:
2 1 1 0 0 0 2 0 0 2
output:
0
result:
ok 1 number(s): "0"
Test #13:
score: 0
Accepted
time: 519ms
memory: 207696kb
input:
1500000 500000 500001 499999 499999 500000 500001 499999 500000 500001
output:
925862004
result:
ok 1 number(s): "925862004"
Test #14:
score: 0
Accepted
time: 221ms
memory: 116684kb
input:
629197 210878 201408 216911 145293 266423 217481 194751 220179 214267
output:
447295633
result:
ok 1 number(s): "447295633"
Test #15:
score: 0
Accepted
time: 207ms
memory: 116692kb
input:
579097 200209 204257 174631 149110 148890 281097 138034 263752 177311
output:
71830925
result:
ok 1 number(s): "71830925"
Test #16:
score: 0
Accepted
time: 96ms
memory: 65424kb
input:
354224 100316 63899 190009 69306 123829 161089 140523 76088 137613
output:
44852283
result:
ok 1 number(s): "44852283"
Test #17:
score: 0
Accepted
time: 540ms
memory: 207712kb
input:
1229851 383009 323934 522908 551226 311238 367387 547622 353128 329101
output:
39721313
result:
ok 1 number(s): "39721313"
Test #18:
score: 0
Accepted
time: 224ms
memory: 118728kb
input:
858452 195309 312080 351063 384805 51797 421850 200466 301164 356822
output:
506491992
result:
ok 1 number(s): "506491992"
Test #19:
score: 0
Accepted
time: 520ms
memory: 207568kb
input:
1424218 661653 323895 438670 467846 488045 468327 369769 343207 711242
output:
782021141
result:
ok 1 number(s): "782021141"
Test #20:
score: 0
Accepted
time: 540ms
memory: 205648kb
input:
1079733 333391 427895 318447 579853 153924 345956 406031 300755 372947
output:
111229812
result:
ok 1 number(s): "111229812"
Test #21:
score: 0
Accepted
time: 216ms
memory: 114768kb
input:
572270 168517 197624 206129 238722 154914 178634 192692 145891 233687
output:
93444378
result:
ok 1 number(s): "93444378"
Test #22:
score: 0
Accepted
time: 94ms
memory: 69572kb
input:
470911 95201 196020 179690 143795 173744 153372 142604 154489 173818
output:
629148200
result:
ok 1 number(s): "629148200"
Test #23:
score: 0
Accepted
time: 89ms
memory: 69572kb
input:
514907 142312 117185 255410 52426 249434 213047 180346 59381 275180
output:
497502651
result:
ok 1 number(s): "497502651"
Test #24:
score: 0
Accepted
time: 100ms
memory: 67840kb
input:
406588 151239 177967 77382 93189 144948 168451 94378 135309 176901
output:
790871601
result:
ok 1 number(s): "790871601"
Test #25:
score: 0
Accepted
time: 37ms
memory: 40892kb
input:
175290 55982 60345 58963 48359 77923 49008 23679 74616 76995
output:
123245869
result:
ok 1 number(s): "123245869"
Test #26:
score: 0
Accepted
time: 553ms
memory: 207700kb
input:
1387914 512757 474809 400348 378268 216654 792992 649332 374567 364015
output:
676034326
result:
ok 1 number(s): "676034326"
Test #27:
score: 0
Accepted
time: 211ms
memory: 118596kb
input:
764222 219470 230830 313922 331893 97293 335036 97220 292440 374562
output:
158682546
result:
ok 1 number(s): "158682546"
Test #28:
score: 0
Accepted
time: 216ms
memory: 116940kb
input:
753135 242199 294626 216310 175239 287120 290776 282985 150249 319901
output:
971077263
result:
ok 1 number(s): "971077263"
Test #29:
score: 0
Accepted
time: 216ms
memory: 120764kb
input:
907648 254368 314623 338657 266634 210330 430684 203259 377229 327160
output:
657924076
result:
ok 1 number(s): "657924076"
Test #30:
score: 0
Accepted
time: 218ms
memory: 116676kb
input:
734407 287960 273092 173355 91803 383817 258787 317856 268839 147712
output:
302163640
result:
ok 1 number(s): "302163640"
Test #31:
score: 0
Accepted
time: 209ms
memory: 117152kb
input:
802408 296016 284435 221957 207041 242882 352485 117792 274366 410250
output:
54247530
result:
ok 1 number(s): "54247530"
Test #32:
score: 0
Accepted
time: 201ms
memory: 114628kb
input:
562487 158889 225035 178563 148413 302399 111675 148133 215119 199235
output:
169658542
result:
ok 1 number(s): "169658542"
Test #33:
score: 0
Accepted
time: 224ms
memory: 122832kb
input:
999120 389537 311486 298097 316708 332443 349969 261915 402318 334887
output:
352258886
result:
ok 1 number(s): "352258886"
Test #34:
score: 0
Accepted
time: 512ms
memory: 207712kb
input:
1409159 427245 484076 497838 435890 528804 444465 588832 314386 505941
output:
887383005
result:
ok 1 number(s): "887383005"
Test #35:
score: 0
Accepted
time: 210ms
memory: 120708kb
input:
1003619 340241 274051 389327 166457 383901 453261 211841 434615 357163
output:
353962733
result:
ok 1 number(s): "353962733"
Test #36:
score: 0
Accepted
time: 3ms
memory: 16984kb
input:
22574 9246 5094 8234 9209 7482 5883 12089 6331 4154
output:
60839910
result:
ok 1 number(s): "60839910"
Test #37:
score: 0
Accepted
time: 509ms
memory: 207700kb
input:
1415532 478588 564750 372194 512789 526677 376066 217017 566262 632253
output:
625939628
result:
ok 1 number(s): "625939628"
Test #38:
score: 0
Accepted
time: 203ms
memory: 114640kb
input:
662723 241713 270544 150466 205318 236372 221033 329239 165257 168227
output:
186211005
result:
ok 1 number(s): "186211005"
Test #39:
score: 0
Accepted
time: 536ms
memory: 203600kb
input:
1096822 586933 218335 291554 392825 346250 357747 326051 392267 378504
output:
128569855
result:
ok 1 number(s): "128569855"
Test #40:
score: 0
Accepted
time: 551ms
memory: 207744kb
input:
1246485 277064 449274 520147 467862 333900 444723 590215 427647 228623
output:
695555486
result:
ok 1 number(s): "695555486"
Test #41:
score: 0
Accepted
time: 90ms
memory: 67480kb
input:
351715 120661 101781 129273 142995 80157 128563 169330 148880 33505
output:
466480620
result:
ok 1 number(s): "466480620"
Test #42:
score: 0
Accepted
time: 216ms
memory: 118724kb
input:
905498 381722 200474 323302 202271 344030 359197 350698 364396 190404
output:
346377686
result:
ok 1 number(s): "346377686"
Test #43:
score: 0
Accepted
time: 499ms
memory: 205652kb
input:
1064626 261709 325862 477055 516569 367130 180927 307746 452237 304643
output:
557495758
result:
ok 1 number(s): "557495758"
Test #44:
score: 0
Accepted
time: 95ms
memory: 65492kb
input:
494104 224009 132488 137607 15527 180865 297712 203418 197294 93392
output:
0
result:
ok 1 number(s): "0"
Test #45:
score: 0
Accepted
time: 513ms
memory: 207568kb
input:
1153008 315731 708637 128640 128519 347757 676732 267014 535519 350475
output:
0
result:
ok 1 number(s): "0"
Test #46:
score: 0
Accepted
time: 523ms
memory: 207740kb
input:
1470490 550743 481409 438338 763576 96662 610252 363836 262517 844137
output:
964914867
result:
ok 1 number(s): "964914867"
Test #47:
score: 0
Accepted
time: 91ms
memory: 66340kb
input:
476270 72377 235854 168039 1528 311122 163620 254184 15707 206379
output:
0
result:
ok 1 number(s): "0"
Test #48:
score: 0
Accepted
time: 221ms
memory: 115868kb
input:
787189 201940 129464 455785 243491 290356 253342 257543 326980 202666
output:
0
result:
ok 1 number(s): "0"
Test #49:
score: 0
Accepted
time: 544ms
memory: 207568kb
input:
1311581 662049 427399 222133 182392 768551 360638 257311 534768 519502
output:
0
result:
ok 1 number(s): "0"
Test #50:
score: 0
Accepted
time: 33ms
memory: 39428kb
input:
215077 105142 95920 14015 37417 106030 71630 97785 86292 31000
output:
0
result:
ok 1 number(s): "0"
Test #51:
score: 0
Accepted
time: 213ms
memory: 115324kb
input:
680614 190222 59142 431250 229277 326583 124754 244226 267501 168887
output:
0
result:
ok 1 number(s): "0"
Test #52:
score: 0
Accepted
time: 232ms
memory: 114644kb
input:
599441 163256 359629 76556 269072 153998 176371 296850 273987 28604
output:
0
result:
ok 1 number(s): "0"
Test #53:
score: 0
Accepted
time: 594ms
memory: 205524kb
input:
1186565 664884 314828 206853 50093 597130 539342 352770 117639 716156
output:
0
result:
ok 1 number(s): "0"
Test #54:
score: 0
Accepted
time: 96ms
memory: 63688kb
input:
399589 160429 157151 82009 52807 151045 195737 168413 46646 184530
output:
0
result:
ok 1 number(s): "0"
Test #55:
score: 0
Accepted
time: 95ms
memory: 69580kb
input:
498263 277597 129082 91584 146928 169294 182041 198001 220974 79288
output:
20392590
result:
ok 1 number(s): "20392590"
Test #56:
score: 0
Accepted
time: 529ms
memory: 207712kb
input:
1287548 598441 439788 249319 532780 427274 327494 984985 96121 206442
output:
157485795
result:
ok 1 number(s): "157485795"
Test #57:
score: 0
Accepted
time: 529ms
memory: 207568kb
input:
1435275 447804 724373 263098 383152 619901 432222 383304 68399 983572
output:
0
result:
ok 1 number(s): "0"
Test #58:
score: 0
Accepted
time: 214ms
memory: 114976kb
input:
699090 240262 213752 245076 255039 260728 183323 234619 115480 348991
output:
0
result:
ok 1 number(s): "0"
Test #59:
score: 0
Accepted
time: 213ms
memory: 119988kb
input:
972438 478545 285919 207974 128489 319801 524148 286253 298521 387664
output:
0
result:
ok 1 number(s): "0"
Test #60:
score: 0
Accepted
time: 92ms
memory: 63496kb
input:
331352 121624 30247 179481 80755 93304 157293 62835 160621 107896
output:
0
result:
ok 1 number(s): "0"
Test #61:
score: 0
Accepted
time: 94ms
memory: 64328kb
input:
425318 161870 195187 68261 58421 111518 255379 98211 149256 177851
output:
0
result:
ok 1 number(s): "0"
Test #62:
score: 0
Accepted
time: 221ms
memory: 112856kb
input:
592741 319914 259579 13248 148647 194672 249422 378967 175386 38388
output:
0
result:
ok 1 number(s): "0"
Test #63:
score: 0
Accepted
time: 217ms
memory: 113632kb
input:
602228 34962 454429 112837 247881 315495 38852 384357 69191 148680
output:
0
result:
ok 1 number(s): "0"
Test #64:
score: 0
Accepted
time: 213ms
memory: 113664kb
input:
610389 373522 193737 43130 62839 130072 417478 138346 203349 268694
output:
0
result:
ok 1 number(s): "0"
Test #65:
score: 0
Accepted
time: 42ms
memory: 39144kb
input:
161360 82645 44242 34473 66788 59603 34969 48139 22450 90771
output:
559061811
result:
ok 1 number(s): "559061811"
Test #66:
score: 0
Accepted
time: 210ms
memory: 112604kb
input:
591506 92336 192103 307067 13873 290990 286643 28921 254667 307918
output:
0
result:
ok 1 number(s): "0"
Test #67:
score: 0
Accepted
time: 221ms
memory: 119320kb
input:
940718 486143 39848 414727 438813 358245 143660 200948 304832 434938
output:
189368763
result:
ok 1 number(s): "189368763"
Test #68:
score: 0
Accepted
time: 201ms
memory: 115548kb
input:
585970 36092 336501 213377 217719 134212 234039 454324 31689 99957
output:
0
result:
ok 1 number(s): "0"
Test #69:
score: 0
Accepted
time: 201ms
memory: 117236kb
input:
814985 350619 424060 40306 318150 477415 19420 296376 381374 137235
output:
0
result:
ok 1 number(s): "0"
Test #70:
score: 0
Accepted
time: 511ms
memory: 207700kb
input:
1212624 635151 355933 221540 382996 340761 488867 28683 189420 994521
output:
0
result:
ok 1 number(s): "0"
Test #71:
score: 0
Accepted
time: 214ms
memory: 116424kb
input:
825460 28354 541876 255230 334422 299199 191839 166016 391674 267770
output:
0
result:
ok 1 number(s): "0"
Test #72:
score: 0
Accepted
time: 214ms
memory: 116284kb
input:
644697 305286 296842 42569 165080 234255 245362 127688 459557 57452
output:
0
result:
ok 1 number(s): "0"
Test #73:
score: 0
Accepted
time: 205ms
memory: 116224kb
input:
604964 3223 299494 302247 292154 126107 186703 77013 270881 257070
output:
0
result:
ok 1 number(s): "0"
Test #74:
score: 0
Accepted
time: 2ms
memory: 12252kb
input:
3 0 1 2 1 1 1 1 1 1
output:
0
result:
ok 1 number(s): "0"
Test #75:
score: 0
Accepted
time: 0ms
memory: 16328kb
input:
4 2 0 2 2 1 1 2 2 0
output:
24
result:
ok 1 number(s): "24"
Test #76:
score: 0
Accepted
time: 2ms
memory: 12240kb
input:
2 1 1 0 1 0 1 0 2 0
output:
0
result:
ok 1 number(s): "0"
Test #77:
score: 0
Accepted
time: 1ms
memory: 12108kb
input:
3 2 1 0 0 1 2 1 2 0
output:
0
result:
ok 1 number(s): "0"
Test #78:
score: 0
Accepted
time: 0ms
memory: 12128kb
input:
3 0 1 2 1 0 2 0 1 2
output:
0
result:
ok 1 number(s): "0"
Test #79:
score: 0
Accepted
time: 0ms
memory: 12232kb
input:
2 0 2 0 1 0 1 0 1 1
output:
0
result:
ok 1 number(s): "0"
Test #80:
score: 0
Accepted
time: 0ms
memory: 12248kb
input:
4 1 2 1 0 2 2 0 2 2
output:
0
result:
ok 1 number(s): "0"
Test #81:
score: 0
Accepted
time: 0ms
memory: 12108kb
input:
1 0 0 1 0 0 1 0 1 0
output:
0
result:
ok 1 number(s): "0"
Test #82:
score: 0
Accepted
time: 0ms
memory: 12244kb
input:
3 1 0 2 1 2 0 2 1 0
output:
0
result:
ok 1 number(s): "0"
Test #83:
score: 0
Accepted
time: 2ms
memory: 16340kb
input:
3 0 1 2 2 0 1 0 1 2
output:
6
result:
ok 1 number(s): "6"
Test #84:
score: 0
Accepted
time: 1ms
memory: 12240kb
input:
3 1 1 1 2 0 1 0 1 2
output:
0
result:
ok 1 number(s): "0"
Test #85:
score: 0
Accepted
time: 1ms
memory: 12280kb
input:
4 1 1 2 1 1 2 2 1 1
output:
0
result:
ok 1 number(s): "0"
Test #86:
score: 0
Accepted
time: 0ms
memory: 12244kb
input:
2 0 2 0 1 0 1 2 0 0
output:
0
result:
ok 1 number(s): "0"
Test #87:
score: 0
Accepted
time: 1ms
memory: 12188kb
input:
2 0 0 2 1 0 1 0 0 2
output:
0
result:
ok 1 number(s): "0"
Test #88:
score: 0
Accepted
time: 0ms
memory: 12112kb
input:
2 0 1 1 0 2 0 2 0 0
output:
0
result:
ok 1 number(s): "0"
Test #89:
score: 0
Accepted
time: 1ms
memory: 12172kb
input:
3 2 0 1 1 1 1 1 1 1
output:
0
result:
ok 1 number(s): "0"
Test #90:
score: 0
Accepted
time: 2ms
memory: 16328kb
input:
5 1 2 2 1 2 2 1 2 2
output:
270
result:
ok 1 number(s): "270"
Test #91:
score: 0
Accepted
time: 1ms
memory: 12224kb
input:
3 2 1 0 1 0 2 0 1 2
output:
0
result:
ok 1 number(s): "0"
Test #92:
score: 0
Accepted
time: 1ms
memory: 12240kb
input:
3 2 1 0 1 0 2 1 1 1
output:
0
result:
ok 1 number(s): "0"
Test #93:
score: 0
Accepted
time: 1ms
memory: 12184kb
input:
4 2 1 1 1 2 1 0 2 2
output:
0
result:
ok 1 number(s): "0"
Test #94:
score: 0
Accepted
time: 1ms
memory: 12240kb
input:
2 0 1 1 2 0 0 0 0 2
output:
0
result:
ok 1 number(s): "0"
Test #95:
score: 0
Accepted
time: 0ms
memory: 12232kb
input:
2 2 0 0 1 1 0 2 0 0
output:
0
result:
ok 1 number(s): "0"
Test #96:
score: 0
Accepted
time: 1ms
memory: 12240kb
input:
4 2 1 1 1 2 1 1 2 1
output:
0
result:
ok 1 number(s): "0"
Test #97:
score: 0
Accepted
time: 2ms
memory: 16328kb
input:
3 2 1 0 1 1 1 1 2 0
output:
6
result:
ok 1 number(s): "6"
Test #98:
score: 0
Accepted
time: 1ms
memory: 12224kb
input:
2 0 2 0 1 0 1 0 0 2
output:
0
result:
ok 1 number(s): "0"
Test #99:
score: 0
Accepted
time: 1ms
memory: 12176kb
input:
2 0 0 2 2 0 0 2 0 0
output:
0
result:
ok 1 number(s): "0"
Test #100:
score: 0
Accepted
time: 0ms
memory: 16320kb
input:
2 1 0 1 0 0 2 0 1 1
output:
2
result:
ok 1 number(s): "2"
Test #101:
score: 0
Accepted
time: 2ms
memory: 12232kb
input:
2 0 0 2 2 0 0 0 0 2
output:
0
result:
ok 1 number(s): "0"
Test #102:
score: 0
Accepted
time: 2ms
memory: 12248kb
input:
3 1 0 2 0 1 2 2 1 0
output:
0
result:
ok 1 number(s): "0"