Submission #1836743
Source Code Expand
#include <iostream>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <climits>
#include <fstream>
#include <bitset>
#include <time.h>
#include <assert.h>
#define LL long long
#define VI vector<int>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x) cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14
using namespace std;
map<int, vector<int>> g;
vector<int> color;
vector<int> depth;
void func(int v, int d, int c) {
if (!color[v]) {
color[v] = c;
}
if (d == 0 || depth[v] >= d ) {
return;
}
FOE(u, g[v]) {
func(u, d - 1, c);
}
}
int main() {
int N, M, a, b;
cin >> N >> M;
FOR(_, 0, M) {
cin >> a >> b;
g[a].push_back(b);
g[b].push_back(a);
}
int Q;
cin >> Q;
vector<int> v(Q, 0), d(Q, 0), c(Q, 0);
FOR(i, 0, Q) {
cin >> v[Q - i - 1] >> d[Q - i - 1] >> c[Q - i - 1];
}
color = vector<int>(N + 1, 0);
depth = vector<int>(N + 1, 0);
FOR(i, 0, Q) {
func(v[i], d[i], c[i]);
}
FOR(i, 1, N + 1) {
cout << color[i] << endl;
}
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Splatter Painting |
User |
MitI_7 |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1973 Byte |
Status |
TLE |
Exec Time |
2108 ms |
Memory |
13824 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 |
AC |
99 ms |
256 KB |
10_02.txt |
AC |
2 ms |
256 KB |
10_03.txt |
AC |
1 ms |
256 KB |
10_04.txt |
AC |
2 ms |
256 KB |
10_05.txt |
AC |
715 ms |
256 KB |
10_06.txt |
AC |
8 ms |
256 KB |
10_07.txt |
AC |
4 ms |
256 KB |
10_08.txt |
AC |
68 ms |
512 KB |
10_09.txt |
AC |
57 ms |
512 KB |
10_10.txt |
AC |
52 ms |
512 KB |
10_11.txt |
AC |
91 ms |
512 KB |
10_12.txt |
AC |
69 ms |
512 KB |
10_13.txt |
AC |
9 ms |
512 KB |
10_14.txt |
AC |
9 ms |
512 KB |
10_15.txt |
AC |
7 ms |
512 KB |
10_16.txt |
TLE |
2103 ms |
512 KB |
10_17.txt |
TLE |
2103 ms |
512 KB |
20_01.txt |
TLE |
2104 ms |
11776 KB |
20_02.txt |
TLE |
2104 ms |
11776 KB |
20_03.txt |
TLE |
2108 ms |
13824 KB |
20_04.txt |
TLE |
2103 ms |
1664 KB |
20_05.txt |
AC |
334 ms |
384 KB |
20_06.txt |
AC |
156 ms |
1664 KB |
20_07.txt |
AC |
101 ms |
384 KB |
20_08.txt |
TLE |
2103 ms |
1280 KB |
20_09.txt |
AC |
45 ms |
384 KB |
20_10.txt |
TLE |
2103 ms |
1152 KB |
20_11.txt |
TLE |
2103 ms |
1536 KB |
20_12.txt |
AC |
500 ms |
11392 KB |
20_13.txt |
AC |
1829 ms |
12544 KB |
20_14.txt |
TLE |
2104 ms |
12544 KB |
20_15.txt |
TLE |
2105 ms |
13560 KB |
20_16.txt |
TLE |
2105 ms |
13560 KB |