Submission #1369499
Source Code Expand
/* ID: 5ak0 PROG: LANG: C++11 */ #include <bits/stdc++.h> #define fr first #define sc second #define pb push_back #define mpr make_pair using namespace std; typedef long long ll; typedef pair<int, int> pii; const int INF = 1e9 + 7, MAXN = 1e5 + 10, MAXD = 11; int n, m, q; int c[MAXN], v, d; vector <int> g[MAXN]; int dp[MAXN][MAXD]; int main(){ #ifndef SAKO //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); #endif // SAKO ios_base::sync_with_stdio(0); cin >> n >> m; for (int i = 1; i <= m; ++i){ cin >> v >> d; g[v].pb(d); g[d].pb(v); } cin >> q; for (int i = 1; i <= q; ++i){ cin >> v >> d >> c[i]; dp[v][d] = i; } for (int i = 9; i >= 0; --i){ for (int j = 1; j <= n; ++j){ dp[j][i] = max(dp[j][i], dp[j][i + 1]); for (auto to : g[j]){ dp[j][i]=max(dp[j][i], dp[to][i + 1]); } } } for (int i = 1; i <= n; ++i) cout << c[dp[i][0]] << "\n"; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Splatter Painting |
User | Sakzhan |
Language | C++14 (GCC 5.4.1) |
Score | 700 |
Code Size | 989 Byte |
Status | AC |
Exec Time | 82 ms |
Memory | 11256 KB |
Judge Result
Set Name | Sample | Subtask1 | All | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | 500 / 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 | 2816 KB |
00_example_02.txt | AC | 2 ms | 2816 KB |
10_01.txt | AC | 2 ms | 2816 KB |
10_02.txt | AC | 2 ms | 2816 KB |
10_03.txt | AC | 2 ms | 2816 KB |
10_04.txt | AC | 2 ms | 2816 KB |
10_05.txt | AC | 2 ms | 2816 KB |
10_06.txt | AC | 2 ms | 2816 KB |
10_07.txt | AC | 2 ms | 2944 KB |
10_08.txt | AC | 3 ms | 2944 KB |
10_09.txt | AC | 3 ms | 2944 KB |
10_10.txt | AC | 3 ms | 2944 KB |
10_11.txt | AC | 3 ms | 2944 KB |
10_12.txt | AC | 3 ms | 2944 KB |
10_13.txt | AC | 3 ms | 2944 KB |
10_14.txt | AC | 3 ms | 2944 KB |
10_15.txt | AC | 3 ms | 2944 KB |
10_16.txt | AC | 3 ms | 2944 KB |
10_17.txt | AC | 3 ms | 2944 KB |
20_01.txt | AC | 80 ms | 10496 KB |
20_02.txt | AC | 82 ms | 10496 KB |
20_03.txt | AC | 82 ms | 10496 KB |
20_04.txt | AC | 15 ms | 3840 KB |
20_05.txt | AC | 3 ms | 2944 KB |
20_06.txt | AC | 14 ms | 7168 KB |
20_07.txt | AC | 4 ms | 2944 KB |
20_08.txt | AC | 18 ms | 3200 KB |
20_09.txt | AC | 3 ms | 2944 KB |
20_10.txt | AC | 18 ms | 3200 KB |
20_11.txt | AC | 25 ms | 3328 KB |
20_12.txt | AC | 56 ms | 10112 KB |
20_13.txt | AC | 72 ms | 10624 KB |
20_14.txt | AC | 76 ms | 10496 KB |
20_15.txt | AC | 68 ms | 11000 KB |
20_16.txt | AC | 67 ms | 11256 KB |