Submission #1196807


Source Code Expand

Copy
#include<bits/stdc++.h>
#define DEBUG 0
/*
*/

using namespace std;

vector<vector<long long int>>D;
vector<long long int>ans;

void saiki(long long int v, long long int d, long long int c) {
	if (d == 0)
	{
		return;
	}
	if (ans[v] == c)
	{
		return;
	}
	ans[v] = c;
	for (auto x : D[v]) {
		saiki(x, d - 1, c);
	}
}

int main() {
	long long int N, M;
	cin >> N >> M;
	D = vector < vector < long long int >>(N);
	ans = vector<long long int>(N);
	for (size_t i = 0; i < M; i++)
	{
		long long int a, b;
		cin >> a >> b;
		a--; b--;
		D[a].push_back(b);
		D[b].push_back(a);
	}

	long long int Q;
	cin >> Q;
	for (size_t i = 0; i < Q; i++)
	{
		long long int v, d, c;
		cin >> v >> d >> c;
		v--;
		d++;
		saiki(v, d, c);
	}
	for (size_t i = 0; i < N; i++)
	{
		cout << ans[i] << endl;
	}

	if (DEBUG)
	{
		int ewataeoprgjpsrteog;
		cin >> ewataeoprgjpsrteog;
	}
}

Submission Info

Submission Time
Task B - Splatter Painting
User goryudyuma
Language C++14 (GCC 5.4.1)
Score 0
Code Size 924 Byte
Status
Exec Time 2104 ms
Memory 7296 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 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
Case Name Status Exec Time Memory
00_example_01.txt 1 ms 256 KB
00_example_02.txt 1 ms 256 KB
10_01.txt 2 ms 256 KB
10_02.txt 2 ms 256 KB
10_03.txt 1 ms 256 KB
10_04.txt 2 ms 256 KB
10_05.txt 2 ms 256 KB
10_06.txt 1 ms 256 KB
10_07.txt 4 ms 256 KB
10_08.txt 10 ms 384 KB
10_09.txt 9 ms 384 KB
10_10.txt 9 ms 384 KB
10_11.txt 9 ms 384 KB
10_12.txt 9 ms 384 KB
10_13.txt 6 ms 384 KB
10_14.txt 6 ms 384 KB
10_15.txt 5 ms 384 KB
10_16.txt 29 ms 384 KB
10_17.txt 29 ms 384 KB
20_01.txt 1661 ms 7296 KB
20_02.txt 1687 ms 7296 KB
20_03.txt 1692 ms 7296 KB
20_04.txt 105 ms 1536 KB
20_05.txt 10 ms 256 KB
20_06.txt 149 ms 3456 KB
20_07.txt 8 ms 256 KB
20_08.txt
20_09.txt 7 ms 256 KB
20_10.txt 115 ms 256 KB
20_11.txt
20_12.txt 219 ms 6656 KB
20_13.txt 315 ms 7040 KB
20_14.txt 343 ms 6784 KB
20_15.txt
20_16.txt