Submission #1195325
Source Code Expand
#include <bits/stdc++.h> using namespace std; ifstream fin("f.in"); ofstream fout("f.out"); #define hello cout << "hello" << endl #define dbg(var) cout << #var << " --> " << var << endl #define mset(a, b) memset(a, b, sizeof(a)) #define vi vector<int> #define vii vector<pair<int, int> > #define pii pair<int, int> #define pb push_back #define mp make_pair #define fi first #define se second #define ll long long #define boost ios_base::sync_with_stdio(false) const int MOD = 1e9 + 7; const double EPS = 1e-6; const int N = 1e5 + 10; vector<int> g[N]; int color[N]; // bool vis[N]; void dfs(int u, int level, int c, int fa){ color[u] = c; if(level == 0) return; // vis[u] = true; for(int i = 0; i < g[u].size(); ++i){ int v = g[u][i]; if(color[v] != c){ dfs(v, level - 1, c, u); } } } int main(){ boost; int n, m; cin >> n >> m; for(int i = 0; i < m; ++i){ int u, v; cin >> u >> v; g[u].pb(v); g[v].pb(u); } int q; cin >> q; while(q--){ int u, d, c; cin >> u >> d >> c; dfs(u, d, c, 0); } for(int i = 1; i <= n; ++i){ cout << color[i] << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Splatter Painting |
User | kpn64 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1166 Byte |
Status | WA |
Exec Time | 2104 ms |
Memory | 7808 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 | AC | 2 ms | 2560 KB |
10_01.txt | WA | 3 ms | 2688 KB |
10_02.txt | AC | 2 ms | 2560 KB |
10_03.txt | AC | 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 | 5 ms | 2688 KB |
10_08.txt | WA | 8 ms | 2688 KB |
10_09.txt | WA | 8 ms | 2688 KB |
10_10.txt | WA | 8 ms | 2688 KB |
10_11.txt | WA | 8 ms | 2688 KB |
10_12.txt | WA | 8 ms | 2688 KB |
10_13.txt | WA | 6 ms | 2688 KB |
10_14.txt | WA | 6 ms | 2688 KB |
10_15.txt | AC | 5 ms | 2688 KB |
10_16.txt | AC | 29 ms | 2688 KB |
10_17.txt | AC | 29 ms | 2688 KB |
20_01.txt | WA | 1590 ms | 7808 KB |
20_02.txt | WA | 1324 ms | 6144 KB |
20_03.txt | WA | 1362 ms | 6144 KB |
20_04.txt | WA | 45 ms | 3328 KB |
20_05.txt | WA | 8 ms | 2688 KB |
20_06.txt | AC | 141 ms | 3200 KB |
20_07.txt | WA | 6 ms | 2688 KB |
20_08.txt | WA | 431 ms | 2816 KB |
20_09.txt | WA | 6 ms | 2688 KB |
20_10.txt | WA | 71 ms | 2688 KB |
20_11.txt | WA | 773 ms | 2688 KB |
20_12.txt | WA | 171 ms | 6144 KB |
20_13.txt | WA | 234 ms | 6400 KB |
20_14.txt | WA | 244 ms | 6272 KB |
20_15.txt | TLE | 2104 ms | 6520 KB |
20_16.txt | TLE | 2104 ms | 6520 KB |