답안 #581042

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
581042 2022-06-22T08:44:27 Z alirezasamimi100 장난감 기차 (IOI17_train) C++17
5 / 100
10 ms 1620 KB
#include "train.h"
#include <bits/stdc++.h>

#define pb push_back

using namespace std;

const int N = 5e3 + 10;

vector<int> in[N], out[N];
bool f[N], g[N];

void add_edge(int v, int u){
    out[v].pb(u);
    in[u].pb(v);
    if(u == v + 1) g[v] = 1;
    else f[v] = 1;
}

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
    int n = a.size(), m = u.size();
    vector<int> res(n);
    for(int i = 0; i < m; i++) add_edge(u[i], v[i]);
    res[n - 1] = r[n - 1];
    for(int i = n - 2; i >= 0; i--){
        if(a[i]){
            if((f[i] && r[i]) || (g[i] && res[i + 1])) res[i] = 1;
            else res[i] = 0;
        }else{
            if((f[i] && !r[i]) || (g[i] && !res[i + 1])) res[i] = 0;
            else res[i] = 1;
        }
    }
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1108 KB Output is correct
2 Correct 4 ms 1064 KB Output is correct
3 Correct 4 ms 1108 KB Output is correct
4 Correct 6 ms 1068 KB Output is correct
5 Correct 4 ms 1108 KB Output is correct
6 Correct 4 ms 1108 KB Output is correct
7 Correct 4 ms 1108 KB Output is correct
8 Correct 4 ms 1108 KB Output is correct
9 Correct 4 ms 1108 KB Output is correct
10 Correct 4 ms 1092 KB Output is correct
11 Correct 3 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 468 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1620 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 1364 KB 3rd lines differ - on the 21st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 1580 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1108 KB Output is correct
2 Correct 4 ms 1064 KB Output is correct
3 Correct 4 ms 1108 KB Output is correct
4 Correct 6 ms 1068 KB Output is correct
5 Correct 4 ms 1108 KB Output is correct
6 Correct 4 ms 1108 KB Output is correct
7 Correct 4 ms 1108 KB Output is correct
8 Correct 4 ms 1108 KB Output is correct
9 Correct 4 ms 1108 KB Output is correct
10 Correct 4 ms 1092 KB Output is correct
11 Correct 3 ms 1108 KB Output is correct
12 Incorrect 1 ms 468 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
13 Halted 0 ms 0 KB -