# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
113222 | 2019-05-24T11:12:33 Z | 김세빈(#2857) | Sleepy game (innopolis2018_final_D) | C++14 | 75 ms | 8184 KB |
#include <bits/stdc++.h> using namespace std; vector <int> V[101010], Q; int D[101010], P[101010]; bool chk[101010], ans[101010], dis[101010]; int n, m, s; int main() { int i, a, b, p; bool f = 0; scanf("%d%d", &n, &m); for(i=1; i<=n; i++){ scanf("%d", &a); for(; a--; ){ scanf("%d", &b); V[b].push_back(i); D[i] ++; } if(!D[i]){ chk[i] = 1; ans[i] = 0; Q.push_back(i); } } for(; !Q.empty(); ){ p = Q.back(); Q.pop_back(); for(int &t: V[p]) if(!chk[t]){ chk[t] = 1; ans[t] = 1; P[t] = p; for(int &x: V[t]) if(!chk[x]){ D[x] --; if(D[x] == 0){ chk[x] = 1; ans[x] = 0; P[x] = t; Q.push_back(x); } } } } scanf("%d", &s); if(ans[s]){ printf("Win\n"); for(; s; s=P[s]) printf("%d ", s); printf("\n"); return 0; } for(i=1; i<=n; i++){ for(int &t: V[i]) if(t == s) { dis[i] = 1; break; } } for(i=1; i<=n; i++){ for(int &t: V[i]) if(dis[t]){ if(chk[i] && ans[i]){ printf("Win\n%d %d", s, t); for(s=i; s; s=P[s]) printf(" %d", s); printf("\n"); return 0; } else if(!chk[i]) f = 1; break; } } if(f) printf("Draw\n"); else printf("Lose\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2688 KB | Correct solution. |
2 | Correct | 4 ms | 2688 KB | Correct solution. |
3 | Correct | 4 ms | 2688 KB | Correct solution. |
4 | Correct | 37 ms | 6392 KB | Correct solution. |
5 | Correct | 23 ms | 5120 KB | Correct solution. |
6 | Correct | 49 ms | 6392 KB | Correct solution. |
7 | Correct | 55 ms | 8184 KB | Correct solution. |
8 | Correct | 40 ms | 7036 KB | Correct solution. |
9 | Correct | 64 ms | 7032 KB | Correct solution. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2688 KB | Correct solution. |
2 | Correct | 4 ms | 2688 KB | Correct solution. |
3 | Correct | 4 ms | 2688 KB | Correct solution. |
4 | Correct | 75 ms | 7736 KB | Correct solution. |
5 | Correct | 4 ms | 2780 KB | Correct solution. |
6 | Incorrect | 10 ms | 3200 KB | Participant's answer is Lose, but jury's is Win. |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2688 KB | Correct solution. |
2 | Correct | 6 ms | 2688 KB | Correct solution. |
3 | Correct | 4 ms | 2688 KB | Correct solution. |
4 | Correct | 4 ms | 2688 KB | Correct solution. |
5 | Correct | 4 ms | 2688 KB | Correct solution. |
6 | Correct | 5 ms | 2816 KB | Correct solution. |
7 | Incorrect | 6 ms | 2816 KB | Participant's answer is Lose, but jury's is Win. |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2688 KB | Correct solution. |
2 | Correct | 6 ms | 2688 KB | Correct solution. |
3 | Correct | 4 ms | 2688 KB | Correct solution. |
4 | Correct | 4 ms | 2688 KB | Correct solution. |
5 | Correct | 4 ms | 2688 KB | Correct solution. |
6 | Correct | 5 ms | 2816 KB | Correct solution. |
7 | Incorrect | 6 ms | 2816 KB | Participant's answer is Lose, but jury's is Win. |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2688 KB | Correct solution. |
2 | Correct | 4 ms | 2688 KB | Correct solution. |
3 | Correct | 4 ms | 2688 KB | Correct solution. |
4 | Correct | 37 ms | 6392 KB | Correct solution. |
5 | Correct | 23 ms | 5120 KB | Correct solution. |
6 | Correct | 49 ms | 6392 KB | Correct solution. |
7 | Correct | 55 ms | 8184 KB | Correct solution. |
8 | Correct | 40 ms | 7036 KB | Correct solution. |
9 | Correct | 64 ms | 7032 KB | Correct solution. |
10 | Correct | 3 ms | 2688 KB | Correct solution. |
11 | Correct | 4 ms | 2688 KB | Correct solution. |
12 | Correct | 4 ms | 2688 KB | Correct solution. |
13 | Correct | 75 ms | 7736 KB | Correct solution. |
14 | Correct | 4 ms | 2780 KB | Correct solution. |
15 | Incorrect | 10 ms | 3200 KB | Participant's answer is Lose, but jury's is Win. |
16 | Halted | 0 ms | 0 KB | - |