Submission #1452611
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
int N, M, Q, col[100009], lst[11][100009];
vector < int > h[100009];
int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);
scanf ("%d %d", &N, &M);
while (M --)
{
int x, y;
scanf ("%d %d", &x, &y);
h[x].push_back (y);
h[y].push_back (x);
}
scanf ("%d", &Q);
for (int i=1; i<=Q; i++)
{
int x, d;
scanf ("%d %d %d", &x, &d, &col[i]);
lst[d][x] = i;
}
for (int lev=10; lev>=1; lev--)
for (int u=1; u<=N; u++)
if (lst[lev][u] > 0)
for (auto v : h[u])
if (lst[lev][u] > lst[lev - 1][v])
lst[lev - 1][v] = lst[lev][u];
for (int i=1; i<=N; i++)
{
int latest = 0;
for (int j=0; j<=10; j++)
if (lst[j][i] > latest)
latest = lst[j][i];
printf ("%d\n", col[latest]);
}
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Splatter Painting |
User |
geniucos |
Language |
C++14 (GCC 5.4.1) |
Score |
700 |
Code Size |
910 Byte |
Status |
AC |
Exec Time |
95 ms |
Memory |
11128 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:13:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf ("%d %d", &N, &M);
^
./Main.cpp:17:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf ("%d %d", &x, &y);
^
./Main.cpp:21:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf ("%d", &Q);
^
./Main.cpp:25:40: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf ("%d %d %d", &x, &d, &col[i]);
^
Judge Result
Set Name |
Sample |
Subtask1 |
All |
Score / Max Score |
0 / 0 |
200 / 200 |
500 / 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 |
3 ms |
4352 KB |
00_example_02.txt |
AC |
3 ms |
6400 KB |
10_01.txt |
AC |
3 ms |
6400 KB |
10_02.txt |
AC |
3 ms |
6400 KB |
10_03.txt |
AC |
3 ms |
6400 KB |
10_04.txt |
AC |
3 ms |
6400 KB |
10_05.txt |
AC |
3 ms |
6400 KB |
10_06.txt |
AC |
3 ms |
6400 KB |
10_07.txt |
AC |
3 ms |
6400 KB |
10_08.txt |
AC |
4 ms |
6528 KB |
10_09.txt |
AC |
5 ms |
6400 KB |
10_10.txt |
AC |
4 ms |
6400 KB |
10_11.txt |
AC |
4 ms |
6528 KB |
10_12.txt |
AC |
4 ms |
6528 KB |
10_13.txt |
AC |
4 ms |
6400 KB |
10_14.txt |
AC |
4 ms |
6400 KB |
10_15.txt |
AC |
4 ms |
6400 KB |
10_16.txt |
AC |
4 ms |
6528 KB |
10_17.txt |
AC |
4 ms |
6528 KB |
20_01.txt |
AC |
95 ms |
10496 KB |
20_02.txt |
AC |
91 ms |
10496 KB |
20_03.txt |
AC |
93 ms |
10496 KB |
20_04.txt |
AC |
16 ms |
7040 KB |
20_05.txt |
AC |
4 ms |
6400 KB |
20_06.txt |
AC |
13 ms |
7040 KB |
20_07.txt |
AC |
5 ms |
6400 KB |
20_08.txt |
AC |
19 ms |
6784 KB |
20_09.txt |
AC |
4 ms |
6400 KB |
20_10.txt |
AC |
18 ms |
6656 KB |
20_11.txt |
AC |
24 ms |
6912 KB |
20_12.txt |
AC |
49 ms |
9856 KB |
20_13.txt |
AC |
75 ms |
10496 KB |
20_14.txt |
AC |
76 ms |
10496 KB |
20_15.txt |
AC |
70 ms |
11000 KB |
20_16.txt |
AC |
71 ms |
11128 KB |