Submission #1520979
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; const ull mod = 1e9 + 7; #define REP(i,n) for(int i=0;i<(int)n;++i) int DP[100005][10]; typedef vector<int> Edges; Edges G[100005]; void dfs(int v, int d, int t){ if(DP[v][d]==-1){ DP[v][d] = t; } if(d>0){ REP(i, G[v].size()){ dfs(G[v][i], d-1, t); } dfs(v, d-1, t); } } int main(){ int N, M; cin >> N >> M; REP(i, M){ int a, b; cin >> a >> b; a--;b--; G[a].push_back(b); G[b].push_back(a); } int Q; cin >> Q; int c[Q], d[Q], v[Q]; REP(i, Q){ cin >> v[Q-1-i] >> d[Q-1-i] >> c[Q-1-i]; v[Q-1-i]--; } REP(i, N) REP(j, 10) DP[i][j] = -1; REP(i, Q){ dfs(v[i], d[i], i); } REP(i, N){ cout <<(DP[i][0]!=-1 ? c[DP[i][0]] : 0) << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Splatter Painting |
User | theory_and_me |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1076 Byte |
Status | WA |
Exec Time | 2104 ms |
Memory | 11648 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 | 4352 KB |
00_example_02.txt | AC | 2 ms | 4352 KB |
10_01.txt | AC | 102 ms | 4352 KB |
10_02.txt | AC | 2 ms | 4352 KB |
10_03.txt | AC | 3 ms | 4352 KB |
10_04.txt | AC | 2 ms | 4352 KB |
10_05.txt | AC | 759 ms | 4352 KB |
10_06.txt | AC | 34 ms | 4352 KB |
10_07.txt | AC | 5 ms | 4352 KB |
10_08.txt | WA | 210 ms | 4352 KB |
10_09.txt | AC | 179 ms | 4352 KB |
10_10.txt | AC | 162 ms | 4352 KB |
10_11.txt | WA | 337 ms | 4352 KB |
10_12.txt | AC | 241 ms | 4352 KB |
10_13.txt | WA | 18 ms | 4352 KB |
10_14.txt | WA | 24 ms | 4352 KB |
10_15.txt | WA | 14 ms | 4352 KB |
10_16.txt | TLE | 2103 ms | 4352 KB |
10_17.txt | TLE | 2103 ms | 4480 KB |
20_01.txt | TLE | 2104 ms | 10496 KB |
20_02.txt | TLE | 2104 ms | 10496 KB |
20_03.txt | TLE | 2104 ms | 10496 KB |
20_04.txt | TLE | 2103 ms | 4992 KB |
20_05.txt | WA | 1980 ms | 4352 KB |
20_06.txt | WA | 148 ms | 6656 KB |
20_07.txt | WA | 705 ms | 4480 KB |
20_08.txt | TLE | 2104 ms | 5248 KB |
20_09.txt | WA | 320 ms | 4352 KB |
20_10.txt | TLE | 2103 ms | 5248 KB |
20_11.txt | TLE | 2104 ms | 5504 KB |
20_12.txt | WA | 557 ms | 11648 KB |
20_13.txt | TLE | 2104 ms | 10240 KB |
20_14.txt | TLE | 2104 ms | 10368 KB |
20_15.txt | TLE | 2104 ms | 11128 KB |
20_16.txt | TLE | 2104 ms | 11128 KB |