답안 #598576

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
598576 2022-07-18T14:16:25 Z Lucpp 장난감 기차 (IOI17_train) C++17
5 / 100
7 ms 620 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> U, vector<int> V) {
    int n = (int)a.size();
    vector<bool> self(n), nxt(n);
    for(int i = 0; i < (int)U.size(); i++) if(U[i] == V[i]) self[U[i]] = true; else nxt[U[i]] = true;
    vector<int> dp(n);
    dp[n-1] = r[n-1];
    for(int i = n-2; i >= 0; i--){
        if(!nxt[i]) dp[i] = r[i];
        else if(a[i] == 1){
            dp[i] = dp[i+1] || (self[i] && r[i]);
        }
        else{
            dp[i] = dp[i+1] && !(self[i] && !r[i]);
        }
    }
    return dp;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 468 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 3 ms 468 KB Output is correct
4 Correct 3 ms 596 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 3 ms 596 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 3 ms 568 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 3 ms 460 KB Output is correct
11 Correct 3 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 616 KB Output is correct
2 Correct 5 ms 616 KB Output is correct
3 Correct 6 ms 596 KB Output is correct
4 Incorrect 7 ms 620 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 596 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 620 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 468 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 3 ms 468 KB Output is correct
4 Correct 3 ms 596 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 3 ms 596 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 3 ms 568 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 3 ms 460 KB Output is correct
11 Correct 3 ms 468 KB Output is correct
12 Incorrect 1 ms 212 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -