結果

問題 No.1266 7 Colors
ユーザー tailstails
提出日時 2020-10-23 23:59:51
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 645 bytes
コンパイル時間 3,501 ms
コンパイル使用メモリ 176,744 KB
実行使用メモリ 14,664 KB
最終ジャッジ日時 2023-09-19 01:42:10
合計ジャッジ時間 8,910 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,364 KB
testcase_01 AC 3 ms
5,356 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 22 ms
14,664 KB
testcase_19 AC 20 ms
12,012 KB
testcase_20 AC 20 ms
12,012 KB
testcase_21 AC 11 ms
7,660 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,7+(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