Submission #1194617
Source Code Expand
#include<algorithm> #include<cmath> #include<iomanip> #include<iostream> #include<map> #include<numeric> #include<queue> #include<set> #include<sstream> #include<vector> using namespace std; using uint = unsigned int; using ll = long long; const int M = 1e9 + 7; const ll MLL = 1e18L + 9; #pragma unused(M) #pragma unused(MLL) #ifdef LOCAL #include"rprint.hpp" #else template <class... T> void printl(T&&...){ } template <class... T> void printc(T&&...){ } template <class... T> void prints(T&&...){ } template <class... T> void printd(T&&...){ } #endif struct Node{ int color = 0; vector<Node*> dests; void add(Node* n){ dests.push_back(n); } void add2(Node* n){ add(n); n->add(this); } void dfs(Node* from, int c, int rem){ color = c; if(!rem){ return; } for(Node* d : dests){ if(d == from){ continue; } d -> dfs(this, c, rem - 1); } } }; int main(){ int n, m; cin >> n >> m; vector<Node> nodes(n); for(int i=0;i<m;i++){ int a, b; cin >> a >> b; a--; b--; nodes[a].add2(&nodes[b]); } int q; cin >> q; for(int i=0;i<q;i++){ int v, d, c; cin >> v >> d >> c; v--; nodes[v].dfs(nullptr, c, d); } for(int i=0;i<n;i++){ cout << nodes[i].color << '\n'; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Splatter Painting |
User | sumoooru |
Language | C++14 (Clang 3.8.0) |
Score | 200 |
Code Size | 1460 Byte |
Status | TLE |
Exec Time | 2104 ms |
Memory | 7424 KB |
Judge Result
Set Name | Sample | Subtask1 | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 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 | 6 ms | 888 KB |
00_example_02.txt | AC | 1 ms | 256 KB |
10_01.txt | AC | 70 ms | 256 KB |
10_02.txt | AC | 1 ms | 256 KB |
10_03.txt | AC | 1 ms | 256 KB |
10_04.txt | AC | 1 ms | 256 KB |
10_05.txt | AC | 473 ms | 256 KB |
10_06.txt | AC | 2 ms | 256 KB |
10_07.txt | AC | 2 ms | 256 KB |
10_08.txt | AC | 11 ms | 384 KB |
10_09.txt | AC | 10 ms | 384 KB |
10_10.txt | AC | 10 ms | 384 KB |
10_11.txt | AC | 11 ms | 384 KB |
10_12.txt | AC | 11 ms | 384 KB |
10_13.txt | AC | 5 ms | 384 KB |
10_14.txt | AC | 5 ms | 384 KB |
10_15.txt | AC | 4 ms | 384 KB |
10_16.txt | AC | 24 ms | 384 KB |
10_17.txt | AC | 24 ms | 384 KB |
20_01.txt | AC | 1423 ms | 7424 KB |
20_02.txt | AC | 1451 ms | 7296 KB |
20_03.txt | AC | 1729 ms | 7296 KB |
20_04.txt | TLE | 2103 ms | 1536 KB |
20_05.txt | AC | 19 ms | 256 KB |
20_06.txt | AC | 35 ms | 3456 KB |
20_07.txt | AC | 15 ms | 256 KB |
20_08.txt | TLE | 2103 ms | 512 KB |
20_09.txt | AC | 13 ms | 256 KB |
20_10.txt | AC | 313 ms | 256 KB |
20_11.txt | TLE | 2103 ms | 512 KB |
20_12.txt | AC | 213 ms | 6656 KB |
20_13.txt | AC | 383 ms | 7040 KB |
20_14.txt | AC | 451 ms | 6784 KB |
20_15.txt | TLE | 2104 ms | 7284 KB |
20_16.txt | TLE | 2104 ms | 7284 KB |