QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#96960#6325. Peaceful ResultsxiaoyaowudiAC ✓287ms86060kbC++146.0kb2023-04-16 09:47:232023-04-16 09:47:24

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-16 09:47:24]
  • 评测
  • 测评结果:AC
  • 用时:287ms
  • 内存:86060kb
  • [2023-04-16 09:47:23]
  • 提交

answer

#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
using ll=long long;
namespace polynomial
{
	constexpr int P(998244353),N(500010),PR(3),APR((P+1)/PR);
	int ws[2][N<<2],fac[N<<2],ifac[N<<2],fn,fb,lgg[N<<2],_inv[N<<2],rev[N<<2];
	int fast_pow(int a,int b){int ans(1),off(a);while(b){if(b&1) ans=1ll*ans*off%P;off=1ll*off*off%P;b>>=1;}return ans;}
	void init_poly_weights(int len)
	{
		fn=1,fb=0;while(fn<(len<<1)) fn<<=1,++fb;
		_inv[1]=1;for(int i(2);i<=fn;++i) _inv[i]=1ll*(P-P/i)*_inv[P%i]%P;
		ifac[0]=fac[0]=1;for(int i(1);i<=fn;++i) fac[i]=1ll*i*fac[i-1]%P,ifac[i]=1ll*ifac[i-1]*_inv[i]%P;
		for(int i(0);i<fn;++i) rev[i]=(rev[i>>1]>>1)|((i&1)<<(fb-1));
		for(int i(2);i<=fn;++i) lgg[i]=lgg[(i+1)>>1]+1;
		for(int mid((fn>>1)),j0(fast_pow(PR,(P-1)/(mid<<1))),j1(fast_pow(APR,(P-1)/(mid<<1)));mid>=1;mid>>=1,j0=1ll*j0*j0%P,j1=1ll*j1*j1%P)
		for(int i(0),w0(1),w1(1);i<mid;++i,w0=1ll*w0*j0%P,w1=1ll*w1*j1%P) ws[0][i+mid]=w0,ws[1][i+mid]=w1;
	}
	using poly=std::vector<int>;
	int redu(int k){return k>=P?k-P:k;}
	poly operator+(const poly &a,const poly &b)
	{
		poly ret(b);if(ret.size()<a.size()) ret.resize(a.size());
		for(int i(0);i<a.size();++i) ret[i]=redu(ret[i]+a[i]);
		return ret;
	}
	unsigned int tt[N<<2];
	unsigned int W(unsigned int k){return k>=P?k-P:k;}
	void NTT(poly &p,int V)
	{
		int bts(lgg[p.size()]);if(p.size()!=(1<<bts)) p.resize((1<<bts));
		int* w(ws[(V==1)?0:1]),len(1<<bts);for(int i(0);i<len;++i) tt[i]=p[rev[i]>>(fb-bts)];
		unsigned int t1,t2;
		for(int l(2);l<=len;l<<=1)
			for(int j(0),mid=(l>>1);j<len;j+=l)
				for(int i(0);i<mid;++i) t1=tt[j+i],t2=1ull*tt[j+i+mid]*w[mid+i]%P,tt[j+i]=W(t1+t2),tt[j+i+mid]=W(P+t1-t2);
		if(V==1) for(int i(0);i<len;++i) p[i]=tt[i];
		else for(int i(0),j(_inv[len]);i<len;++i) p[i]=1ull*tt[i]*j%P;
	}
	poly operator*(const poly &a,const poly &b)
	{
		static poly p1,p2;poly ret;
		p1=a,p2=b;int len(a.size()+b.size()-1),ff(1<<lgg[len]);
		p1.resize(ff),p2.resize(ff),ret.resize(ff);
		NTT(p1,1);NTT(p2,1);
		for(int i(0);i<ff;++i) ret[i]=1ll*p1[i]*p2[i]%P;
		NTT(ret,-1);ret.resize(len);return ret;
	}
	void print_poly(const poly &a){for(int v:a) printf("%d ",v);printf("\n");}
	poly poly_inv(const poly &a)
	{
		int l(a.size());if(l==1){poly ret(1);ret[0]=fast_pow(a[0],P-2);return ret;}
		poly g0(a);g0.resize((l+1)>>1);g0=poly_inv(g0);
		static poly p1;p1=a;int ff(2<<lgg[l]);poly ret(ff);g0.resize(ff);p1.resize(ff);
		NTT(p1,1);NTT(g0,1);for(int i(0);i<ff;++i) ret[i]=1ll*g0[i]*(2-1ll*g0[i]*p1[i]%P+P)%P;
		NTT(ret,-1);ret.resize(l);return ret;
	}
	poly poly_ln(const poly &a)
	{
		int l(a.size());static poly p1;
		p1.resize(l-1);for(int i(1);i<l;++i) p1[i-1]=1ll*i*a[i]%P;
		p1=p1*poly_inv(a);p1.resize(l-1);poly ret(l);
		for(int i(1);i<l;++i) ret[i]=1ll*_inv[i]*p1[i-1]%P;ret[0]=0;
		return ret;
	}
	poly poly_exp(const poly &a)
	{
		int l(a.size());if(l==1){poly ret(1);ret[0]=1;return ret;}
		poly g0(a);g0.resize((l+1)>>1);g0=poly_exp(g0);static poly g1,g2;g1=g0;g1.resize(l);g1=poly_ln(g1);g2=a;
		int ff(2<<lgg[l]);g0.resize(ff);g1.resize(ff);poly ret(ff);g2.resize(ff);
		NTT(g0,1);NTT(g1,1);NTT(g2,1);
		for(int i(0);i<ff;++i) ret[i]=1ll*g0[i]*(1-g1[i]+g2[i]+P)%P;
		NTT(ret,-1);ret.resize(l);return ret;
	}
	std::pair<int,int> cf[N];// u/(1+dx)
	std::pair<poly,poly> calc(int l,int r)
	{
		if(l==r)
		{
			auto [u,d]=cf[l];
			return {{u},{1,d}};
		}
		int mid((l+r)>>1);
		auto [ls,lt]=calc(l,mid);
		auto [rs,rt]=calc(mid+1,r);
		int T(1<<lgg[r-l+2]);ls.resize(T);lt.resize(T);rs.resize(T);rt.resize(T);
		poly s(T),t(T);
		NTT(ls,1);NTT(lt,1);NTT(rs,1);NTT(rt,1);
		for(int i(0);i<T;++i) s[i]=(1ll*ls[i]*rt[i]+1ll*rs[i]*lt[i])%P,t[i]=1ll*lt[i]*rt[i]%P;
		NTT(s,-1);NTT(t,-1);s.resize(r-l+1);t.resize(r-l+2);
		return {s,t};
	}
	poly solve_fs(const std::vector<std::pair<int,int>> &a,int m)
	{
		int n(a.size());
		std::copy(a.begin(),a.end(),cf+1);
		auto [s,t]=calc(1,n);
		t.resize(m+1);
		t=poly_inv(t);
		s=s*t;
		s.resize(m+1);
		return s;
	}
	const poly unit_poly={1};
}
using polynomial::poly;
using polynomial::operator*;
using polynomial::operator+;
using polynomial::init_poly_weights;
using polynomial::unit_poly;
using polynomial::print_poly;
using polynomial::poly_inv;
using polynomial::poly_exp;
using polynomial::poly_ln;
using polynomial::solve_fs;
constexpr int N(1500010),p(998244353);
int main()
{
	init_poly_weights(N/3);
	int n;std::cin>>n;
	static int ifac[N],fac[N],inv[N];inv[1]=1;
	for(int i(2);i<N;++i) inv[i]=1ll*inv[p%i]*(p-p/i)%p;
	ifac[0]=fac[0]=1;for(int i(1);i<N;++i) ifac[i]=1ll*ifac[i-1]*inv[i]%p,fac[i]=1ll*fac[i-1]*i%p;
	static int s[3][3],d[3],r[3];
	for(int i(0);i<3;++i) for(int j(0);j<3;++j) std::cin>>s[i][j],d[j]+=s[i][j];
	if((d[1]-d[0])%3 || (d[2]-d[0])%3){std::cout<<"0"<<std::endl;return 0;}
	int bs(*std::min_element(d,d+3));
	int mn(1e9),mp(0);
	for(int i(0);i<3;++i)
	{
		r[i]=(d[i]-bs)/3;
		for(int j(0);j<3;++j)
		{
			s[j][i]-=r[i];
			if(s[j][i]<0)
			{
				std::cout<<"0"<<std::endl;
				return 0;
			}
		}
	}
	for(int i(0);i<3;++i){if(s[i][0]<mn) mn=s[i][0],mp=i;}
	if(mp) std::swap(s[0],s[mp]);
	for(int i(0);i<3;++i)
	{
		int diff(s[i][0]+s[i][1]-s[(i+1)%3][2]-s[(i+2)%3][2]);
		if(diff){std::cout<<"0"<<std::endl;return 0;}
	}
	//a:j,b:k,c:i
	int dk(s[1][0]-s[2][2]),di(s[2][0]-s[0][2]+dk);
	poly f(s[0][0]+1),g(s[0][0]+1);
	for(int j(0);j<=s[0][0];++j) if(j+dk>=0 && j+di>=0)
	{
		f[j]=1ll*ifac[j]*ifac[j+dk]%p*ifac[j+di]%p;
	}
	int dbk(s[1][0]-s[0][0]-dk),dci(s[2][0]-s[0][0]-di);
	for(int j(0);j<=s[0][0];++j) if(j+dbk>=0 && j+dci>=0)
	{
		g[j]=1ll*ifac[j]*ifac[j+dbk]%p*ifac[j+dci]%p;
	}
	// std::cerr<<dk<<" "<<di<<" "<<dbk<<" "<<dci<<std::endl;
	f=f*g;f.resize(s[0][0]+1);
	int ans(0);
	for(int i(0);i<=s[0][0];++i)
	{
		int num(3*i+s[1][0]+s[2][0]-s[0][0]*2);
		int cur(f[i]);
		for(int j(0);j<3;++j) cur=1ll*cur*ifac[s[0][0]-i+r[j]]%p,num+=s[0][0]-i+r[j];
		// std::cerr<<num<<std::endl;
		ans=(ans+1ll*cur*fac[n])%p;
	}
	std::cout<<ans<<std::endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 32ms
memory: 66084kb

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: 34ms
memory: 61984kb

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: 81ms
memory: 69596kb

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: 271ms
memory: 85972kb

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: 287ms
memory: 86060kb

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: 25ms
memory: 64108kb

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: 32ms
memory: 66160kb

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: 28ms
memory: 66188kb

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: 41ms
memory: 66144kb

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: 20ms
memory: 64096kb

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: 281ms
memory: 85976kb

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: 28ms
memory: 64092kb

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: 282ms
memory: 86004kb

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: 152ms
memory: 74992kb

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: 146ms
memory: 72888kb

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: 72ms
memory: 67624kb

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: 159ms
memory: 75568kb

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: 181ms
memory: 75212kb

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: 163ms
memory: 75944kb

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: 152ms
memory: 75428kb

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: 139ms
memory: 75012kb

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: 87ms
memory: 71524kb

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: 62ms
memory: 67660kb

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: 84ms
memory: 71576kb

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: 40ms
memory: 67056kb

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: 155ms
memory: 75672kb

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: 92ms
memory: 69484kb

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: 144ms
memory: 73228kb

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: 151ms
memory: 75496kb

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: 57ms
memory: 67640kb

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: 95ms
memory: 71696kb

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: 161ms
memory: 75016kb

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: 152ms
memory: 76024kb

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: 271ms
memory: 85092kb

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: 138ms
memory: 75204kb

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: 39ms
memory: 66224kb

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: 161ms
memory: 75568kb

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: 75ms
memory: 71764kb

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: 146ms
memory: 73480kb

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: 159ms
memory: 75660kb

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: 102ms
memory: 69316kb

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: 146ms
memory: 75316kb

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: 153ms
memory: 75584kb

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: 19ms
memory: 64100kb

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: 32ms
memory: 64032kb

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: 97ms
memory: 71452kb

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: 28ms
memory: 64084kb

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: 19ms
memory: 64024kb

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: 26ms
memory: 64032kb

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: 52ms
memory: 64104kb

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: 35ms
memory: 64108kb

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: 31ms
memory: 64040kb

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: 24ms
memory: 64092kb

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: 26ms
memory: 64080kb

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: 61ms
memory: 65584kb

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: 83ms
memory: 71548kb

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: 35ms
memory: 62052kb

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: 29ms
memory: 64032kb

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: 34ms
memory: 64100kb

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: 25ms
memory: 64108kb

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: 38ms
memory: 64128kb

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: 23ms
memory: 64076kb

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: 29ms
memory: 64100kb

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: 24ms
memory: 64028kb

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: 40ms
memory: 65020kb

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: 30ms
memory: 64096kb

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: 54ms
memory: 67676kb

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: 34ms
memory: 64112kb

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: 34ms
memory: 64092kb

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: 21ms
memory: 64036kb

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: 37ms
memory: 64032kb

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: 36ms
memory: 64100kb

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: 24ms
memory: 64040kb

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: 36ms
memory: 64104kb

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: 41ms
memory: 66080kb

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: 19ms
memory: 64028kb

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: 36ms
memory: 64040kb

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: 34ms
memory: 64032kb

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: 36ms
memory: 64032kb

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: 39ms
memory: 64044kb

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: 32ms
memory: 64096kb

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: 32ms
memory: 64028kb

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: 43ms
memory: 66156kb

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: 24ms
memory: 64096kb

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: 22ms
memory: 64100kb

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: 26ms
memory: 64032kb

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: 42ms
memory: 64028kb

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: 35ms
memory: 64024kb

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: 34ms
memory: 64092kb

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: 45ms
memory: 64036kb

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: 36ms
memory: 64076kb

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: 43ms
memory: 64028kb

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: 43ms
memory: 64080kb

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: 35ms
memory: 64028kb

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: 37ms
memory: 64076kb

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: 33ms
memory: 64100kb

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: 33ms
memory: 64036kb

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: 31ms
memory: 64024kb

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: 26ms
memory: 64076kb

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: 42ms
memory: 64088kb

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: 27ms
memory: 64048kb

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: 41ms
memory: 64088kb

input:

3
1 0 2
0 1 2
2 1 0

output:

0

result:

ok 1 number(s): "0"