Submission #1413721


Source Code Expand

#include <cstdio> 
#define For(x) for (int h=head[x],o=V[h]; h; o=V[h=to[h]])
#define add(u,v) (to[++num]=head[u],head[u]=num,V[num]=v)
int num,head[2005],to[4005],V[4005];
int Q,n,m,v[2005],d[2005],c[2005],cl[2005],rg[2005];

void dfs(int x,int ran,int col){
	//printf("[%d]\t%d\t%d\n",x,ran,col);
	if (rg[x]>=ran || ran<=0) return;
	rg[x]=ran;
	cl[x]=col;
	For(x) dfs(o,ran-1,col);
}

int main(){
	freopen("1.txt","r",stdin);
	scanf("%d%d",&n,&m);
	for (int i=1,x,y; i<=m; i++){
		scanf("%d%d",&x,&y);
		add(x,y);
		add(y,x);
	}
	scanf("%d",&Q);
	for (int i=1; i<=Q; i++) scanf("%d%d%d",&v[i],&d[i],&c[i]);	
	for (int i=Q; i; i--) dfs(v[i],d[i]+1,c[i]);
	for (int i=1; i<=n; i++) printf("%d\n",cl[i]);
}

//http://agc012.contest.atcoder.jp/tasks/agc012_b

Submission Info

Submission Time
Task B - Splatter Painting
User vjudge1
Language Bash (GNU bash v4.3.11)
Score 0
Code Size 756 Byte
Status RE
Exec Time 2 ms
Memory 536 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 0 / 200 0 / 500
Status
RE × 2
RE × 19
RE × 35
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt
Subtask1 00_example_01.txt, 00_example_02.txt, 10_01.txt, 10_02.txt, 10_03.txt, 10_04.txt, 10_05.txt, 10_06.txt, 10_07.txt, 10_08.txt, 10_09.txt, 10_10.txt, 10_11.txt, 10_12.txt, 10_13.txt, 10_14.txt, 10_15.txt, 10_16.txt, 10_17.txt
All 00_example_01.txt, 00_example_02.txt, 10_01.txt, 10_02.txt, 10_03.txt, 10_04.txt, 10_05.txt, 10_06.txt, 10_07.txt, 10_08.txt, 10_09.txt, 10_10.txt, 10_11.txt, 10_12.txt, 10_13.txt, 10_14.txt, 10_15.txt, 10_16.txt, 10_17.txt, 20_01.txt, 20_02.txt, 20_03.txt, 20_04.txt, 20_05.txt, 20_06.txt, 20_07.txt, 20_08.txt, 20_09.txt, 20_10.txt, 20_11.txt, 20_12.txt, 20_13.txt, 20_14.txt, 20_15.txt, 20_16.txt
Case Name Status Exec Time Memory
00_example_01.txt RE 2 ms 536 KB
00_example_02.txt RE 2 ms 532 KB
10_01.txt RE 2 ms 536 KB
10_02.txt RE 2 ms 532 KB
10_03.txt RE 2 ms 536 KB
10_04.txt RE 2 ms 532 KB
10_05.txt RE 2 ms 536 KB
10_06.txt RE 2 ms 532 KB
10_07.txt RE 2 ms 536 KB
10_08.txt RE 2 ms 536 KB
10_09.txt RE 2 ms 536 KB
10_10.txt RE 2 ms 536 KB
10_11.txt RE 2 ms 536 KB
10_12.txt RE 2 ms 536 KB
10_13.txt RE 2 ms 536 KB
10_14.txt RE 2 ms 532 KB
10_15.txt RE 2 ms 536 KB
10_16.txt RE 2 ms 536 KB
10_17.txt RE 2 ms 532 KB
20_01.txt RE 2 ms 536 KB
20_02.txt RE 2 ms 536 KB
20_03.txt RE 2 ms 536 KB
20_04.txt RE 2 ms 532 KB
20_05.txt RE 2 ms 532 KB
20_06.txt RE 2 ms 536 KB
20_07.txt RE 2 ms 536 KB
20_08.txt RE 2 ms 536 KB
20_09.txt RE 2 ms 532 KB
20_10.txt RE 2 ms 536 KB
20_11.txt RE 2 ms 532 KB
20_12.txt RE 2 ms 532 KB
20_13.txt RE 2 ms 536 KB
20_14.txt RE 2 ms 536 KB
20_15.txt RE 2 ms 536 KB
20_16.txt RE 2 ms 536 KB