Submission #1195264
Source Code Expand
#include<stdio.h> #include<vector> #include<queue> #define rep(i,n)for(int i=0;i<(n);i++) #define MOD 1000000007 #define INF 0x3f3f3f3f #define INFL 0x3f3f3f3f3f3f3f3f #define EPS (1e-10) using namespace std; typedef long long ll; typedef pair<int, int>P; #define mygc(c) (c)=getchar_unlocked() #define mypc(c) putchar_unlocked(c) void reader(int *x) { int k, m = 0; *x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { *x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; *x = (*x) * 10 + k - '0'; }if (m)(*x) = -(*x); } void reader(int *x, int *y) { reader(x); reader(y); } void reader(int *x, int *y, int *z) { reader(x); reader(y); reader(z); } void writer(int x, char c) { int i, sz = 0, m = 0; char buf[10]; if (x<0)m = 1, x = -x; while (x)buf[sz++] = x % 10, x /= 10; if (!sz)buf[sz++] = 0; if (m)mypc('-'); while (sz--)mypc(buf[sz] + '0'); mypc(c); } vector<int>E[100000]; int d1[100000]; int c1[100000], c2[100000]; int que[100000]; signed main() { int n, m; reader(&n, &m); rep(i, m) { int a, b; reader(&a, &b); a--; b--; E[a].push_back(b); E[b].push_back(a); } int q; reader(&q); memset(c2, -1, sizeof(c2)); rep(i, q) { int v, d, c; reader(&v, &d, &c); v--; int s = 0, g = 0; d1[v] = 0; c2[v] = i; que[g++] = v; while (s != g) { int p = que[s++]; c1[p] = c; if (d1[p] == d)continue; for (int u : E[p]) { if (c2[u] != i) { c2[u] = 1; d1[u] = d1[p] + 1; que[g++] = u; } } } } rep(i, n)writer(c1[i], '\n'); }
Submission Info
Submission Time | |
---|---|
Task | B - Splatter Painting |
User | autumn_eel |
Language | C++14 (Clang 3.8.0) |
Score | 0 |
Code Size | 1565 Byte |
Status | RE |
Exec Time | 2104 ms |
Memory | 7672 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 | WA | 2 ms | 2944 KB |
00_example_02.txt | AC | 2 ms | 2944 KB |
10_01.txt | WA | 3 ms | 3072 KB |
10_02.txt | AC | 2 ms | 2944 KB |
10_03.txt | AC | 2 ms | 2944 KB |
10_04.txt | AC | 2 ms | 2944 KB |
10_05.txt | WA | 3 ms | 3072 KB |
10_06.txt | AC | 2 ms | 2944 KB |
10_07.txt | AC | 2 ms | 3072 KB |
10_08.txt | WA | 12 ms | 3456 KB |
10_09.txt | WA | 11 ms | 3456 KB |
10_10.txt | WA | 11 ms | 3328 KB |
10_11.txt | RE | 99 ms | 3456 KB |
10_12.txt | RE | 102 ms | 3456 KB |
10_13.txt | AC | 3 ms | 3200 KB |
10_14.txt | AC | 3 ms | 3456 KB |
10_15.txt | AC | 3 ms | 3200 KB |
10_16.txt | RE | 97 ms | 3456 KB |
10_17.txt | RE | 97 ms | 3456 KB |
20_01.txt | RE | 113 ms | 6912 KB |
20_02.txt | RE | 114 ms | 6912 KB |
20_03.txt | RE | 112 ms | 6912 KB |
20_04.txt | RE | 102 ms | 4096 KB |
20_05.txt | RE | 124 ms | 3456 KB |
20_06.txt | AC | 4 ms | 3968 KB |
20_07.txt | AC | 24 ms | 3200 KB |
20_08.txt | TLE | 2104 ms | 3328 KB |
20_09.txt | AC | 10 ms | 3072 KB |
20_10.txt | WA | 553 ms | 3200 KB |
20_11.txt | TLE | 2103 ms | 3456 KB |
20_12.txt | AC | 41 ms | 7168 KB |
20_13.txt | RE | 168 ms | 7168 KB |
20_14.txt | RE | 193 ms | 7040 KB |
20_15.txt | RE | 108 ms | 7672 KB |
20_16.txt | RE | 108 ms | 7672 KB |