Submission #1195297
Source Code Expand
/* In the name of Allah
The most beneficent,
The most merciful
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define read freopen("in.txt","r",stdin)
#define write freopen("out.txt","w",stdout)
#define ck puts("ok")
#define reset(a,d) memset(a,d,sizeof(a))
#define CASE(i) printf("Case %lld: ", i)
#define pb(a,b) a.push_back(b)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define DIST(x1,y1, x2, y2) (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)))
#define DIST3D(x1,x2, y1, y2, z1, z2) (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)) + ((z1-z2)*(z1-z2)))
#define ALL(x) (x).begin(),(x).end()
#define LLA(x) x.rbegin(), x.rend()
#define SORT(v) sort(ALL(v))
#define inf 1<<30
#define mod 1000000007
#define PI acos(-1.0)
string sss="0123456789ABCDEF";
//-----------------------------------------------------------//
vector<ll>G[100009];
ll col[100009],dis;
bool vis[100009];
void dfs(ll n,ll dur,ll rong)
{
if(dur>dis||vis[n])return ;
col[n]=rong;
ll sz=G[n].size();
for(int i=0; i<sz; i++)
{
ll now=G[n][i];
if(vis[now])continue;
dfs(now,dur+1,rong);
}
}
void dfsvis(ll n)
{
if(vis[n]==0)return;
vis[n]=0;
ll sz=G[n].size();
for(int i=0; i<sz; i++)
{
ll now=G[n][i];
if(vis[now]==0)continue;
dfsvis(now);
}
}
int main()
{
ll n,m,i,x,y,q,a,cl;
cin>>n>>m;
for(i=1; i<=m; i++)
{
cin>>x>>y;
pb(G[x],y);
pb(G[y],x);
}
cin>>q;
while(q--)
{
cin>>x>>dis>>cl;
dfs(x,0,cl);
dfsvis(x);
}
for(i=1;i<=n;i++)cout<<col[i]<<endl;
}
Submission Info
Submission Time |
|
Task |
B - Splatter Painting |
User |
murad_al_wajed |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1804 Byte |
Status |
TLE |
Exec Time |
2104 ms |
Memory |
8960 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 |
1303 ms |
2688 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 |
TLE |
2103 ms |
2688 KB |
10_06.txt |
AC |
19 ms |
2560 KB |
10_07.txt |
AC |
5 ms |
2560 KB |
10_08.txt |
AC |
76 ms |
2688 KB |
10_09.txt |
AC |
58 ms |
2688 KB |
10_10.txt |
AC |
55 ms |
2688 KB |
10_11.txt |
AC |
104 ms |
2688 KB |
10_12.txt |
AC |
76 ms |
2688 KB |
10_13.txt |
AC |
9 ms |
2688 KB |
10_14.txt |
AC |
9 ms |
2688 KB |
10_15.txt |
AC |
8 ms |
2688 KB |
10_16.txt |
TLE |
2103 ms |
2688 KB |
10_17.txt |
TLE |
2103 ms |
2688 KB |
20_01.txt |
TLE |
2104 ms |
6912 KB |
20_02.txt |
TLE |
2104 ms |
6912 KB |
20_03.txt |
TLE |
2103 ms |
8960 KB |
20_04.txt |
TLE |
2103 ms |
3712 KB |
20_05.txt |
AC |
465 ms |
2560 KB |
20_06.txt |
AC |
143 ms |
3584 KB |
20_07.txt |
AC |
120 ms |
2560 KB |
20_08.txt |
TLE |
2103 ms |
2816 KB |
20_09.txt |
AC |
44 ms |
2560 KB |
20_10.txt |
TLE |
2103 ms |
2560 KB |
20_11.txt |
TLE |
2103 ms |
2816 KB |
20_12.txt |
AC |
284 ms |
6912 KB |
20_13.txt |
AC |
781 ms |
7168 KB |
20_14.txt |
AC |
950 ms |
7040 KB |
20_15.txt |
TLE |
2104 ms |
7284 KB |
20_16.txt |
TLE |
2104 ms |
7284 KB |