AtCoder Grand Contest 012

Submission #1352146

Source codeソースコード

#include<bits/stdc++.h>
using namespace std;
int n, m, q, col[100005][15];
int a[100005], b[100005], c[100005];
vector<int> adj[100005];

void bfs (int I, int D, int V) {
	queue<pair<int,int> > Q;
	col[I][D] = V;
	Q.push({I, D});
	while(!Q.empty()) {
		int A = Q.front().first, B = Q.front().second;
		Q.pop();
		for(auto &X : adj[A]) {
			if(col[X][B-1]) continue;
			col[X][B-1] = V;
			if(B-1) Q.push({X, B-1});
		}
	}
}

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++) {
		int A, B;
		scanf("%d%d",&A,&B);
		adj[A].push_back(B);
		adj[B].push_back(A);
	}
	scanf("%d",&q);
	for(int i=1;i<=q;i++) {
		scanf("%d%d%d",&a[i],&b[i],&c[i]);
	}
	for(int i=q;i>=1;i--) {
		if(!col[a[i]][b[i]]) bfs(a[i], b[i], i);
	}
	for(int i=1;i<=n;i++) {
		int A = 0;
		for(int j=0;j<=10;j++) {
			A = max(A, col[i][j]);
		}
		printf("%d\n",c[A]);
	}
}

Submission

Task問題 B - Splatter Painting
User nameユーザ名 khsoo01
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 890 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:24:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d",&n,&m);
^
./Main.cpp:27:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d",&A,&B);
^
./Main.cpp:31:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&q);
^
./Main.cpp:33:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d",&a[i],&b[i],&c[i]);
^

Test case

Set

Set name Score得点 / Max score Cases
Sample - 00_example_01.txt,00_example_02.txt
Subtask1 0 / 200 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 0 / 500 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_example_01.txt AC 3 ms 4352 KB
00_example_02.txt AC 3 ms 4352 KB
10_01.txt AC 3 ms 4352 KB
10_02.txt AC 3 ms 4352 KB
10_03.txt WA
10_04.txt AC 3 ms 4352 KB
10_05.txt AC 3 ms 4352 KB
10_06.txt AC 3 ms 4352 KB
10_07.txt AC 3 ms 4352 KB
10_08.txt WA
10_09.txt WA
10_10.txt WA
10_11.txt WA
10_12.txt WA
10_13.txt WA
10_14.txt WA
10_15.txt WA
10_16.txt AC 4 ms 4480 KB
10_17.txt AC 4 ms 4480 KB
20_01.txt WA
20_02.txt WA
20_03.txt WA
20_04.txt WA
20_05.txt WA
20_06.txt WA
20_07.txt WA
20_08.txt AC 18 ms 4480 KB
20_09.txt WA
20_10.txt AC 18 ms 4352 KB
20_11.txt AC 23 ms 4480 KB
20_12.txt WA
20_13.txt WA
20_14.txt WA
20_15.txt AC 82 ms 13992 KB
20_16.txt AC 82 ms 13992 KB