Submission #1194673
Source Code Expand
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>
using namespace std;
typedef pair<int, int> Pi;
typedef long long ll;
#define pii Pi
#define pll PL
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> PL;
typedef long double ldouble;
int n, m, q;
vector <int> E[100010];
int Q[100010][3];
int D[100010];
int color[100010];
void dfs(int v, int d, int c){
if(D[v] >= c)return;
D[v] = c;
if(color[v] == 0)color[v] = c;
if(d == 0)return;
for(int e : E[v]){
dfs(e, d-1, c);
}
}
void solve(){
scanf("%d%d", &n, &m);
rep(i, m){
int x, y; scanf("%d%d", &x, &y);
E[x].pb(y);
E[y].pb(x);
}
scanf("%d", &q);
rep(i, q){
rep(j, 3)scanf("%d", Q[i]+j);
}
for(int i=q-1;i>=0;i--){
int v = Q[i][0], d = Q[i][1], c = Q[i][2];
dfs(v, d, c);
}
for(int i=1;i<=n;i++)printf("%d\n", color[i]);
}
int main(){
int Tc = 1; // scanf("%d\n", &Tc);
for(int tc=1;tc<=Tc;tc++){
solve();
}
}
Submission Info
Submission Time |
|
Task |
B - Splatter Painting |
User |
molamola |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1428 Byte |
Status |
WA |
Exec Time |
76 ms |
Memory |
8440 KB |
Compile Error
./Main.cpp: In function ‘void solve()’:
./Main.cpp:52:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &n, &m);
^
./Main.cpp:54:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
int x, y; scanf("%d%d", &x, &y);
^
./Main.cpp:58:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &q);
^
./Main.cpp:60:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
rep(j, 3)scanf("%d", Q[i]+j);
^
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 |
WA |
2 ms |
2688 KB |
10_02.txt |
AC |
2 ms |
2560 KB |
10_03.txt |
WA |
2 ms |
2560 KB |
10_04.txt |
AC |
2 ms |
2560 KB |
10_05.txt |
WA |
2 ms |
2688 KB |
10_06.txt |
AC |
2 ms |
2560 KB |
10_07.txt |
AC |
2 ms |
2560 KB |
10_08.txt |
WA |
3 ms |
2688 KB |
10_09.txt |
WA |
3 ms |
2688 KB |
10_10.txt |
WA |
3 ms |
2688 KB |
10_11.txt |
WA |
3 ms |
2688 KB |
10_12.txt |
WA |
3 ms |
2688 KB |
10_13.txt |
WA |
3 ms |
2688 KB |
10_14.txt |
WA |
3 ms |
2688 KB |
10_15.txt |
WA |
3 ms |
2688 KB |
10_16.txt |
AC |
3 ms |
2688 KB |
10_17.txt |
AC |
3 ms |
2688 KB |
20_01.txt |
WA |
75 ms |
7808 KB |
20_02.txt |
WA |
76 ms |
7808 KB |
20_03.txt |
WA |
76 ms |
7808 KB |
20_04.txt |
WA |
13 ms |
3328 KB |
20_05.txt |
WA |
4 ms |
2688 KB |
20_06.txt |
AC |
11 ms |
3584 KB |
20_07.txt |
WA |
4 ms |
2688 KB |
20_08.txt |
WA |
21 ms |
3584 KB |
20_09.txt |
WA |
4 ms |
2688 KB |
20_10.txt |
WA |
22 ms |
3456 KB |
20_11.txt |
WA |
27 ms |
3840 KB |
20_12.txt |
WA |
42 ms |
6656 KB |
20_13.txt |
WA |
64 ms |
7552 KB |
20_14.txt |
WA |
69 ms |
7680 KB |
20_15.txt |
AC |
71 ms |
8312 KB |
20_16.txt |
AC |
70 ms |
8440 KB |