Submission #1195295
Source Code Expand
#include <iostream> #include <vector> using namespace std; void update(vector<int>& color, vector<vector<int>>& edge, vector<bool>& done, int v, int d, int c){ if(d < 0 || done[v]) return; color[v] = c; done[v] = true; for(auto&& next:edge[v]) update(color, edge, done, next, d - 1, c); } int main(){ int n, m, q; cin >> n >> m; vector<int> color(n, 0); vector<vector<int>> edge(n); while(m--){ int from, to; cin >> from >> to; from--; to--; edge[from].emplace_back(to); edge[to].emplace_back(from); } cin >> q; while(q--){ int v, d, c; cin >> v >> d >> c; v--; vector<bool> done(n, false); update(color, edge, done, v, d, c); } for(int i = 0; i < n; i++) cout << color[i] << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - Splatter Painting |
User | jbyxm |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 751 Byte |
Status | WA |
Exec Time | 2104 ms |
Memory | 8568 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 | 1 ms | 256 KB |
00_example_02.txt | AC | 1 ms | 256 KB |
10_01.txt | WA | 2 ms | 256 KB |
10_02.txt | AC | 1 ms | 256 KB |
10_03.txt | AC | 1 ms | 256 KB |
10_04.txt | AC | 1 ms | 256 KB |
10_05.txt | WA | 2 ms | 256 KB |
10_06.txt | AC | 1 ms | 256 KB |
10_07.txt | AC | 4 ms | 256 KB |
10_08.txt | WA | 10 ms | 384 KB |
10_09.txt | WA | 9 ms | 384 KB |
10_10.txt | WA | 9 ms | 384 KB |
10_11.txt | WA | 9 ms | 384 KB |
10_12.txt | WA | 9 ms | 384 KB |
10_13.txt | AC | 5 ms | 384 KB |
10_14.txt | AC | 5 ms | 384 KB |
10_15.txt | AC | 5 ms | 384 KB |
10_16.txt | AC | 33 ms | 384 KB |
10_17.txt | AC | 33 ms | 384 KB |
20_01.txt | WA | 1936 ms | 6144 KB |
20_02.txt | WA | 1957 ms | 6144 KB |
20_03.txt | WA | 1994 ms | 6144 KB |
20_04.txt | WA | 101 ms | 1152 KB |
20_05.txt | WA | 11 ms | 256 KB |
20_06.txt | AC | 151 ms | 3072 KB |
20_07.txt | WA | 9 ms | 256 KB |
20_08.txt | TLE | 2103 ms | 384 KB |
20_09.txt | WA | 7 ms | 256 KB |
20_10.txt | WA | 125 ms | 256 KB |
20_11.txt | TLE | 2103 ms | 384 KB |
20_12.txt | AC | 220 ms | 5888 KB |
20_13.txt | AC | 356 ms | 6144 KB |
20_14.txt | AC | 392 ms | 6016 KB |
20_15.txt | TLE | 2104 ms | 6520 KB |
20_16.txt | TLE | 2104 ms | 8568 KB |