답안 #211650

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
211650 2020-03-20T22:31:04 Z thebes Bulb Game (FXCUP4_bulb) C++17
0 / 100
5 ms 384 KB
#include "bulb.h"
#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
#define pb push_back

const int MN = 3e5+5;
int N, i, ok[MN], res[MN], f;
pii ed[MN];

int acc(int n){
    if(res[n]) return res[n];
    res[n]=ed[n].first<0?ed[n].first:acc(ed[n].first);
    return res[n];
}

int FindWinner(int T,vi L,vi R){
    N = L.size();
    int cur = 0;
    for(i=0;i<N;i++) ed[i]={L[i],R[i]};
    while(cur>=0){
        ok[cur] = 1;
        if(ed[cur].second==-1||acc(ed[cur].second)==-1) f=1;
        cur = ed[cur].first;
    }
    if(acc(0)==-2) return 0;
    else return f;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Incorrect 5 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Incorrect 5 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -