Submission #1195301
Source Code Expand
#include <bits/stdc++.h> //#define Ak using namespace std; template< class t> long long int gcd( t g,t h ) { return ( h==0 ? g : gcd(h,g%h) ); } vector< int >v[100005]; int visit[100005]={0},color[100005]={0}; int dfs(int s,int d,int c) { if(d<=0) { return 0; } if(visit[s]==1) { return 0; } visit[s]=1; color[s]=c; vector< int >::iterator k; for(k=v[s].begin();k!=v[s].end();k++) { if(visit[*k]==0) { color[*k]=c; dfs(*k,d-1,c); } } visit[s]=0; return 0; } int main() { /* #ifdef Ak freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); */ int q,n,m,i,j,ans=0,sum=0,a,b,s,d,c; // list< long long int >v; // map< long long int >m; cin>>n>>m; for(i=0;i<m;i++) { cin>>a>>b; a--; b--; v[a].push_back(b); v[b].push_back(a); } cin>>q; while(q--) { cin>>s>>d>>c; s--; dfs(s,d,c); } for(i=0;i<n;i++) { cout<<color[i]<<endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Splatter Painting |
User | Saiyan_Warrior |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1383 Byte |
Status | WA |
Exec Time | 2104 ms |
Memory | 6904 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 | 2560 KB |
00_example_02.txt | AC | 2 ms | 2560 KB |
10_01.txt | AC | 61 ms | 2688 KB |
10_02.txt | WA | 2 ms | 2560 KB |
10_03.txt | WA | 2 ms | 2560 KB |
10_04.txt | WA | 2 ms | 2560 KB |
10_05.txt | AC | 406 ms | 2688 KB |
10_06.txt | AC | 2 ms | 2560 KB |
10_07.txt | WA | 5 ms | 2560 KB |
10_08.txt | WA | 11 ms | 2688 KB |
10_09.txt | WA | 11 ms | 2688 KB |
10_10.txt | WA | 10 ms | 2688 KB |
10_11.txt | WA | 11 ms | 2688 KB |
10_12.txt | WA | 11 ms | 2688 KB |
10_13.txt | WA | 7 ms | 2688 KB |
10_14.txt | WA | 6 ms | 2688 KB |
10_15.txt | WA | 6 ms | 2688 KB |
10_16.txt | AC | 31 ms | 2688 KB |
10_17.txt | AC | 31 ms | 2688 KB |
20_01.txt | WA | 1553 ms | 6528 KB |
20_02.txt | WA | 1571 ms | 6528 KB |
20_03.txt | WA | 1617 ms | 6528 KB |
20_04.txt | TLE | 2103 ms | 3328 KB |
20_05.txt | WA | 15 ms | 2560 KB |
20_06.txt | WA | 149 ms | 3584 KB |
20_07.txt | WA | 10 ms | 2560 KB |
20_08.txt | TLE | 2103 ms | 2688 KB |
20_09.txt | WA | 9 ms | 2560 KB |
20_10.txt | WA | 250 ms | 2560 KB |
20_11.txt | TLE | 2103 ms | 2688 KB |
20_12.txt | WA | 229 ms | 6528 KB |
20_13.txt | WA | 333 ms | 6656 KB |
20_14.txt | WA | 353 ms | 6528 KB |
20_15.txt | TLE | 2104 ms | 6904 KB |
20_16.txt | TLE | 2104 ms | 6904 KB |