Submission #1240787
Source Code Expand
#include <cstdio> #include <cstring> #include <cstdlib> #include <vector> #include <algorithm> using namespace std; struct data { int num; struct data* Next; }; struct node { int color; struct data* next; int nextnum = 0; }; int n, m, q; struct node Node[100001]; int visit[100001]; void color (int v, int d, int c) { Node[v].color = c; int i = v; visit[i] = 1; for (struct data* temp = Node[i].next; temp != NULL; temp = temp -> Next) { //if (visit[Node[i].next[j]]) //continue; if (d == 1) { Node[temp -> num].color = c; } else { Node[temp -> num].color = c; color (temp -> num, d - 1, c); } } visit[i] = 0; } int main () { scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) { Node[i].color = 0; Node[i].nextnum = 0; Node[i].next = NULL; } for (int i = 0; i < m; i++) { int a, b; scanf("%d%d", &a, &b); struct data* A = (struct data*)malloc(sizeof(struct data)); struct data* B = (struct data*)malloc(sizeof(struct data)); A -> num = b; B -> num = a; A -> Next = Node[a].next; B -> Next = Node[b].next; Node[a].next = A; Node[b].next = B; } scanf("%d", &q); memset (visit, 0, sizeof(int) * n); for (int i = 0; i < q; i++) { int v, d, c; scanf("%d%d%d", &v, &d, &c); color (v, d, c); } for (int i = 1; i <= n; i++) { printf("%d\n", Node[i].color); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Splatter Painting |
User | shirochan |
Language | C++14 (Clang 3.8.0) |
Score | 0 |
Code Size | 1748 Byte |
Status | RE |
Exec Time | 2104 ms |
Memory | 271360 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 | RE | 321 ms | 264832 KB |
10_02.txt | AC | 2 ms | 2560 KB |
10_03.txt | RE | 229 ms | 264704 KB |
10_04.txt | AC | 2 ms | 2560 KB |
10_05.txt | RE | 931 ms | 264832 KB |
10_06.txt | RE | 229 ms | 264704 KB |
10_07.txt | AC | 2 ms | 2560 KB |
10_08.txt | RE | 232 ms | 264832 KB |
10_09.txt | RE | 234 ms | 264832 KB |
10_10.txt | RE | 230 ms | 264832 KB |
10_11.txt | RE | 231 ms | 264832 KB |
10_12.txt | RE | 238 ms | 264832 KB |
10_13.txt | RE | 231 ms | 264832 KB |
10_14.txt | RE | 229 ms | 264832 KB |
10_15.txt | RE | 230 ms | 264832 KB |
10_16.txt | TLE | 2103 ms | 2688 KB |
10_17.txt | TLE | 2103 ms | 2688 KB |
20_01.txt | RE | 256 ms | 271360 KB |
20_02.txt | RE | 256 ms | 271360 KB |
20_03.txt | RE | 258 ms | 271360 KB |
20_04.txt | RE | 239 ms | 267264 KB |
20_05.txt | RE | 232 ms | 264704 KB |
20_06.txt | RE | 229 ms | 265088 KB |
20_07.txt | RE | 229 ms | 264704 KB |
20_08.txt | TLE | 2103 ms | 3072 KB |
20_09.txt | RE | 230 ms | 264704 KB |
20_10.txt | RE | 229 ms | 264704 KB |
20_11.txt | TLE | 2103 ms | 3072 KB |
20_12.txt | RE | 253 ms | 270720 KB |
20_13.txt | RE | 254 ms | 270976 KB |
20_14.txt | RE | 252 ms | 270848 KB |
20_15.txt | TLE | 2104 ms | 9216 KB |
20_16.txt | TLE | 2104 ms | 9216 KB |