Submission #1195358
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll ;
typedef long double ld;
#define MOD 1000000007ll
#define all(v) v.begin() , v.end()
#define allr(v) v.rbegin(), v.rend()
#define for0(i,n) for(__typeof(n) i = 0; i < n ; i++)
#define forab(i,a,b) for(__typeof(a) i = a ; i < b ; i++)
#define forba(i,b,a) for(__typeof(a) i = b ; i > a ; i--)
#define forc(c,it) for(__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define pb push_back
#define mp make_pair
#define MAX 100005
int n , m, a, b, v, d, c, q;
vector<int> adj[MAX];
vector<int> colour(MAX , 0);
int main(int argc, char const *argv[])
{
ios_base::sync_with_stdio(false);
scanf("%d %d" , &n , &m);
for0(i , m)
{
scanf("%d %d" , &a , &b);
adj[a].pb(b);
adj[b].pb(a);
}
scanf("%d" , &q);
while(q--)
{
scanf("%d %d %d" , &v , &d , &c);
vector<bool> visited(n+5 , false);
queue<pair<int,int> >qu;
qu.push(mp(v,0));
while(!qu.empty())
{
int t = qu.front().first;
int r = qu.front().second;
visited[t] = true;
// printf("%d\n" , t);
colour[t] = c;
qu.pop();
forc(adj[t] , it)
{
if(!visited[*it])
{
visited[*it] = true;
if(r < d)
qu.push(mp(*it , r + 1));
}
}
}
}
for(int i = 1 ; i <= n ; i++)
printf("%d\n" , colour[i]);
return 0;
}
Submission Info
Submission Time |
|
Task |
A - AtCoder Group Contest |
User |
eager |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1447 Byte |
Status |
RE |
Exec Time |
326 ms |
Memory |
3200 KB |
Compile Error
./Main.cpp: In function ‘int main(int, const char**)’:
./Main.cpp:25:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d" , &n , &m);
^
./Main.cpp:29:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d" , &a , &b);
^
./Main.cpp:34:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d" , &q);
^
./Main.cpp:38:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d %d" , &v , &d , &c);
^
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 300 |
Status |
|
|
Set Name |
Test Cases |
Sample |
00_example_01.txt, 00_example_02.txt |
All |
00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt |
Case Name |
Status |
Exec Time |
Memory |
00_example_01.txt |
WA |
3 ms |
2944 KB |
00_example_02.txt |
RE |
326 ms |
2944 KB |
01.txt |
RE |
96 ms |
2944 KB |
02.txt |
RE |
96 ms |
2944 KB |
03.txt |
RE |
97 ms |
2944 KB |
04.txt |
RE |
96 ms |
2944 KB |
05.txt |
RE |
97 ms |
2944 KB |
06.txt |
RE |
97 ms |
2944 KB |
07.txt |
WA |
10 ms |
3200 KB |
08.txt |
RE |
96 ms |
2944 KB |
09.txt |
RE |
96 ms |
2944 KB |
10.txt |
RE |
97 ms |
2944 KB |