結果

問題 No.1605 Matrix Shape
ユーザー tailstails
提出日時 2021-07-17 18:04:57
言語 cLay
(20240104-1)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 3,610 ms
コンパイル使用メモリ 169,804 KB
実行使用メモリ 9,084 KB
最終ジャッジ日時 2023-09-19 02:32:18
合計ジャッジ時間 6,059 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,460 KB
testcase_01 AC 2 ms
7,524 KB
testcase_02 AC 3 ms
7,412 KB
testcase_03 AC 3 ms
7,412 KB
testcase_04 AC 3 ms
7,468 KB
testcase_05 AC 3 ms
7,472 KB
testcase_06 AC 3 ms
7,480 KB
testcase_07 AC 3 ms
7,512 KB
testcase_08 AC 3 ms
7,416 KB
testcase_09 AC 3 ms
7,444 KB
testcase_10 AC 2 ms
7,520 KB
testcase_11 AC 3 ms
7,476 KB
testcase_12 AC 3 ms
7,588 KB
testcase_13 AC 3 ms
7,672 KB
testcase_14 AC 3 ms
7,396 KB
testcase_15 AC 2 ms
7,572 KB
testcase_16 AC 2 ms
7,600 KB
testcase_17 AC 3 ms
7,392 KB
testcase_18 AC 3 ms
7,484 KB
testcase_19 AC 21 ms
8,956 KB
testcase_20 AC 16 ms
8,404 KB
testcase_21 AC 16 ms
8,672 KB
testcase_22 AC 20 ms
8,888 KB
testcase_23 AC 20 ms
9,084 KB
testcase_24 AC 20 ms
8,904 KB
testcase_25 AC 8 ms
8,040 KB
testcase_26 AC 9 ms
8,292 KB
testcase_27 AC 8 ms
8,184 KB
testcase_28 AC 9 ms
8,016 KB
testcase_29 AC 9 ms
8,212 KB
testcase_30 AC 16 ms
8,672 KB
testcase_31 AC 16 ms
8,624 KB
testcase_32 AC 13 ms
8,284 KB
testcase_33 AC 13 ms
8,192 KB
testcase_34 AC 9 ms
8,004 KB
testcase_35 AC 15 ms
8,744 KB
testcase_36 AC 10 ms
8,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

char vis[2d5+1];
int ioc[2d5+1];
{
	unionFind u;
	u.walloc(2d5+1,1);
	ll@n;
	ll x=0,y=0,z=0;
	rep(n){
		ll@h,@w;
		vis[h]=1;
		vis[w]=1;
		ioc[h]+=1;
		ioc[w]-=1;
		u(h,w);
		x=h;
	}
	x=u(x);
	rep(i,1,2d5+1){
		if(vis[i]){
			if(u(i)!=x||ioc[i]<-1||ioc[i]>1){
				y=2;
			}
			if(ioc[i]==-1){
				y+=1;
			}
			z+=1;
		}
	}
	wt(y>1?0:y?1:z);
}
0