Submission #1194675
Source Code Expand
#include <iostream> #include <algorithm> #include <iomanip> #include <string> #include <functional> #include <utility> #include <queue> #include <vector> #include <string> #include <stack> #define rep(i,n) for(ll i=0;i<n;i++) using namespace std; typedef long long int ll; const ll MOD = 1000000007; typedef pair<ll,ll> P; ll N,M; vector<ll> vec[100100]; ll Q; queue<ll> que; ll ans[100100]; void bfs(ll v ,ll d, ll c){ que.push(v); ans[v] = c; while(!que.empty() && d>0){ ll l=que.size(); d--; rep(i,l){ ll tmp = que.front(); que.pop(); ll l2 = vec[tmp].size(); rep(j,l2){ ll pos = vec[tmp][j]; ans[pos] = c; que.push(pos); } } } while(!que.empty()){ que.pop(); } } int main(){ cin >> N >> M; rep(i,M){ ll a,b; cin >> a >> b; vec[a].push_back(b); vec[b].push_back(a); } cin >> Q; rep(i,Q){ ll v,d,c; cin >> v >> d >> c; bfs(v,d,c); } rep(i,N){ cout << ans[i+1] << endl; } }
Submission Info
Submission Time | |
---|---|
Task | B - Splatter Painting |
User | gamelove765 |
Language | C++11 (GCC 4.8.1) |
Score | 0 |
Code Size | 1013 Byte |
Status | TLE |
Exec Time | 2279 ms |
Memory | 1799416 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 | 7 ms | 3068 KB |
00_example_02.txt | AC | 2 ms | 2560 KB |
10_01.txt | AC | 136 ms | 58244 KB |
10_02.txt | AC | 2 ms | 2560 KB |
10_03.txt | AC | 2 ms | 2560 KB |
10_04.txt | AC | 2 ms | 2560 KB |
10_05.txt | MLE | 1033 ms | 1016864 KB |
10_06.txt | AC | 9 ms | 4752 KB |
10_07.txt | AC | 5 ms | 2560 KB |
10_08.txt | AC | 38 ms | 4788 KB |
10_09.txt | AC | 32 ms | 4204 KB |
10_10.txt | AC | 30 ms | 4352 KB |
10_11.txt | AC | 56 ms | 7192 KB |
10_12.txt | AC | 42 ms | 7532 KB |
10_13.txt | AC | 8 ms | 2816 KB |
10_14.txt | AC | 9 ms | 3968 KB |
10_15.txt | AC | 7 ms | 2944 KB |
10_16.txt | TLE | 2279 ms | -1216144 KB |
10_17.txt | TLE | 2279 ms | -1220972 KB |
20_01.txt | TLE | 2104 ms | 13616 KB |
20_02.txt | TLE | 2104 ms | 22436 KB |
20_03.txt | TLE | 2104 ms | 14860 KB |
20_04.txt | TLE | 2210 ms | 1799416 KB |
20_05.txt | AC | 245 ms | 8896 KB |
20_06.txt | AC | 147 ms | 3584 KB |
20_07.txt | AC | 71 ms | 3468 KB |
20_08.txt | TLE | 2272 ms | -1336872 KB |
20_09.txt | AC | 31 ms | 3072 KB |
20_10.txt | TLE | 2103 ms | 5844 KB |
20_11.txt | TLE | 2267 ms | -1433584 KB |
20_12.txt | AC | 262 ms | 7960 KB |
20_13.txt | AC | 602 ms | 8336 KB |
20_14.txt | AC | 724 ms | 8612 KB |
20_15.txt | TLE | 2166 ms | 1028564 KB |
20_16.txt | TLE | 2164 ms | 1024496 KB |