Submission #1368918
Source Code Expand
#include <bits/stdc++.h> #define pii pair<int, int> #define f first #define s second #define pb push_back #define mp make_pair #define ll long long #define ld long double #define sz(v) int(v.size()) #define all(v) v.begin(), v.end() #define y1 what using namespace std; const int N = (int) 2e5 + 10; const int M = (int) 18; const ll big = (1LL << 51); const ll LINF = (ll) 1e18; const int INF = (int) 1e9 + 7; const double EPS = (double) 1e-6; const double PI = 3.14159265359; int n, m, q; int a[N], b[N], c[N]; vector<int> v[N]; int was[N]; void dfs(int x, int mx, int clr) { if (mx < 0) return; if (!was[x]) { was[x] = clr; } for (auto it : v[x]) { dfs(it, mx - 1, clr); } } int main() { #define fn "balls" #ifdef witch freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #else // freopen(fn".in", "r", stdin); // freopen(fn".out", "w", stdout); #endif srand(time(0)); cin >> n >> m; while (m--) { int x, y; cin >> x >> y; v[x].pb(y); v[y].pb(x); } cin >> q; for (int i = 1; i <= q; i++) { cin >> a[i] >> b[i] >> c[i]; } for (int i = q; i >= 1; i--) { dfs(a[i], b[i], c[i]); } for (int i = 1; i <= n; i++) { cout << was[i] << "\n"; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Splatter Painting |
User | Nurlykhan |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1444 Byte |
Status | TLE |
Exec Time | 2104 ms |
Memory | 10368 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 | 3 ms | 5632 KB |
00_example_02.txt | AC | 3 ms | 5632 KB |
10_01.txt | AC | 1147 ms | 5632 KB |
10_02.txt | AC | 3 ms | 5632 KB |
10_03.txt | AC | 3 ms | 5632 KB |
10_04.txt | AC | 3 ms | 5632 KB |
10_05.txt | TLE | 2103 ms | 5632 KB |
10_06.txt | AC | 17 ms | 5632 KB |
10_07.txt | AC | 3 ms | 5632 KB |
10_08.txt | AC | 63 ms | 5760 KB |
10_09.txt | AC | 47 ms | 5760 KB |
10_10.txt | AC | 45 ms | 5632 KB |
10_11.txt | AC | 85 ms | 5632 KB |
10_12.txt | AC | 63 ms | 5760 KB |
10_13.txt | AC | 6 ms | 5632 KB |
10_14.txt | AC | 7 ms | 5632 KB |
10_15.txt | AC | 5 ms | 5632 KB |
10_16.txt | TLE | 2103 ms | 5760 KB |
10_17.txt | TLE | 2103 ms | 5760 KB |
20_01.txt | TLE | 2103 ms | 10368 KB |
20_02.txt | TLE | 2103 ms | 9600 KB |
20_03.txt | TLE | 2104 ms | 9600 KB |
20_04.txt | TLE | 2103 ms | 6272 KB |
20_05.txt | AC | 385 ms | 5632 KB |
20_06.txt | AC | 15 ms | 6272 KB |
20_07.txt | AC | 98 ms | 5632 KB |
20_08.txt | TLE | 2103 ms | 6272 KB |
20_09.txt | AC | 37 ms | 5632 KB |
20_10.txt | TLE | 2103 ms | 6144 KB |
20_11.txt | TLE | 2103 ms | 6400 KB |
20_12.txt | AC | 151 ms | 9216 KB |
20_13.txt | AC | 554 ms | 9856 KB |
20_14.txt | AC | 689 ms | 9984 KB |
20_15.txt | TLE | 2104 ms | 10232 KB |
20_16.txt | TLE | 2104 ms | 10232 KB |