結果

問題 No.1266 7 Colors
ユーザー tailstails
提出日時 2020-10-24 00:05:31
言語 cLay
(20240104-1)
結果
AC  
実行時間 47 ms / 3,000 ms
コード長 646 bytes
コンパイル時間 3,106 ms
コンパイル使用メモリ 175,912 KB
実行使用メモリ 14,560 KB
最終ジャッジ日時 2023-09-19 01:42:21
合計ジャッジ時間 5,754 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,412 KB
testcase_01 AC 2 ms
5,452 KB
testcase_02 AC 2 ms
5,424 KB
testcase_03 AC 25 ms
7,676 KB
testcase_04 AC 43 ms
12,180 KB
testcase_05 AC 27 ms
9,732 KB
testcase_06 AC 44 ms
12,240 KB
testcase_07 AC 46 ms
12,424 KB
testcase_08 AC 43 ms
12,132 KB
testcase_09 AC 35 ms
9,960 KB
testcase_10 AC 34 ms
9,972 KB
testcase_11 AC 30 ms
9,784 KB
testcase_12 AC 31 ms
9,916 KB
testcase_13 AC 32 ms
10,012 KB
testcase_14 AC 27 ms
9,764 KB
testcase_15 AC 46 ms
12,424 KB
testcase_16 AC 32 ms
9,880 KB
testcase_17 AC 47 ms
12,360 KB
testcase_18 AC 22 ms
14,560 KB
testcase_19 AC 20 ms
12,076 KB
testcase_20 AC 20 ms
12,012 KB
testcase_21 AC 10 ms
7,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

unionFind f;
graph g;
char s[1d5][8];
int u[1d5],v[1d5];
{
	ll@n,@m,@q;
	rd(s(n),(u--,v--)(m));
	f.walloc(7n,1);
	g.setEdge(n,m,u,v);
	rep(i,n){
		rep[g.edge[i]](j,g.es[i]){
			if(i<j){
				rep(k,7){
					if(s[i][k]&s[j][k]&1){
						f(7i+k,7j+k);
					}
				}
			}
		}
		rep(k,7){
			if(s[i][k]&s[i][(k+1)%7]&1){
				f(7i+k,7i+(k+1)%7);
			}
		}
	}
	rep(q){
		int@t,@x,@y;
		--x;
		if(t==1){
			--y;
			s[x][y]='1';
			rep[g.edge[x]](j,g.es[x]){
				if(s[j][y]&1){
					f(7x+y,7j+y);
				}
			}
			if(s[x][(y+1)%7]&1){
				f(7x+y,7x+(y+1)%7);
			}
			if(s[x][(y+6)%7]&1){
				f(7x+y,7x+(y+6)%7);
			}
		}
		if(t==2){
			wt(f.size(7x));
		}
	}
}
0