# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
113241 | 2019-05-24T11:59:15 Z | 김세빈(#2857) | Sleepy game (innopolis2018_final_D) | C++14 | 93 ms | 7656 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; void check(int p, int v, int r) { chk[p] = 1; ans[p] = v; P[p] = r; if(v == 0){ for(int &t: V[p]){ if(!chk[t]){ check(t, 1, p); } } } else{ for(int &t: V[p]){ if(!chk[t]){ D[t] --; if(D[t] == 0) check(t, 0, p); } } } } 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] == 0) check(i, 0, 0); } 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(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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2688 KB | Participant's answer is Draw, but jury's is Lose. |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2688 KB | Correct solution. |
2 | Correct | 3 ms | 2688 KB | Correct solution. |
3 | Correct | 4 ms | 2688 KB | Correct solution. |
4 | Correct | 93 ms | 7656 KB | Correct solution. |
5 | Incorrect | 4 ms | 2688 KB | Participant's answer is Draw, but jury's is Win. |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | 4 ms | 2688 KB | Correct solution. |
5 | Correct | 4 ms | 2688 KB | Correct solution. |
6 | Correct | 5 ms | 2688 KB | Correct solution. |
7 | Incorrect | 5 ms | 2816 KB | Participant's answer is Draw, but jury's is Win. |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | 4 ms | 2688 KB | Correct solution. |
5 | Correct | 4 ms | 2688 KB | Correct solution. |
6 | Correct | 5 ms | 2688 KB | Correct solution. |
7 | Incorrect | 5 ms | 2816 KB | Participant's answer is Draw, but jury's is Win. |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2688 KB | Participant's answer is Draw, but jury's is Lose. |
2 | Halted | 0 ms | 0 KB | - |