Submission #1368996
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define skip continue #define pb push_back const int N = 1e5 + 10; int n, m, q, x[N], dist[N], col[N], color[N]; vector <int> v[N]; bool u[N]; void dfs(int pos, int len, int d, int c){ u[pos] = 1; color[pos] = c; if(len == d) return; for(int i = 0; i < v[pos].size(); ++ i){ int to = v[pos][i]; if(!u[to]){ dfs(to, len + 1, d, c); } } } void change(int pos, int d, int c){ dfs(pos, 0, d, c); } int main(){ cin >> n >> m; for(int i = 1; i <= m; ++ i){ int x1, y; cin >> x1 >> y; v[x1].pb(y); v[y].pb(x1); } //cerr << "OK " << n << ' ' << m << '\n'; cin >> q; for(int i = 1; i <= q; ++ i){ cin >> x[i] >> dist[i] >> col[i]; } for(int i = q; i >= 1; -- i){ if(u[x[i]]) skip; change(x[i], dist[i], col[i]); } //cerr << n << ' ' << m << '\n'; for(int i = 1; i <= n; ++ i){ cout << color[i] << '\n'; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Splatter Painting |
User | KtlTheBest |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 956 Byte |
Status | WA |
Exec Time | 185 ms |
Memory | 8184 KB |
Judge Result
Set Name | Sample | Subtask1 | All | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 200 | 0 / 500 | ||||||||||||
Status |
|
|
|
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 | AC | 2 ms | 2560 KB |
00_example_02.txt | WA | 2 ms | 2560 KB |
10_01.txt | WA | 3 ms | 2688 KB |
10_02.txt | AC | 2 ms | 2560 KB |
10_03.txt | WA | 2 ms | 2560 KB |
10_04.txt | AC | 2 ms | 2560 KB |
10_05.txt | WA | 3 ms | 2688 KB |
10_06.txt | AC | 2 ms | 2560 KB |
10_07.txt | AC | 2 ms | 2560 KB |
10_08.txt | WA | 5 ms | 2688 KB |
10_09.txt | WA | 5 ms | 2688 KB |
10_10.txt | WA | 5 ms | 2688 KB |
10_11.txt | WA | 5 ms | 2688 KB |
10_12.txt | WA | 5 ms | 2688 KB |
10_13.txt | WA | 4 ms | 2688 KB |
10_14.txt | WA | 4 ms | 2688 KB |
10_15.txt | WA | 4 ms | 2688 KB |
10_16.txt | AC | 5 ms | 2688 KB |
10_17.txt | AC | 5 ms | 2688 KB |
20_01.txt | WA | 182 ms | 7424 KB |
20_02.txt | WA | 184 ms | 7424 KB |
20_03.txt | WA | 185 ms | 7424 KB |
20_04.txt | WA | 30 ms | 3328 KB |
20_05.txt | WA | 7 ms | 2688 KB |
20_06.txt | AC | 14 ms | 3328 KB |
20_07.txt | WA | 7 ms | 2688 KB |
20_08.txt | WA | 57 ms | 3584 KB |
20_09.txt | WA | 7 ms | 2688 KB |
20_10.txt | WA | 56 ms | 3456 KB |
20_11.txt | WA | 74 ms | 3840 KB |
20_12.txt | WA | 97 ms | 6272 KB |
20_13.txt | WA | 162 ms | 7296 KB |
20_14.txt | WA | 173 ms | 7424 KB |
20_15.txt | AC | 172 ms | 7928 KB |
20_16.txt | AC | 172 ms | 8184 KB |