답안 #757158

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
757158 2023-06-12T17:55:58 Z alexander707070 장난감 기차 (IOI17_train) C++14
0 / 100
8 ms 3412 KB
#include<bits/stdc++.h>
#define MAXN 100007
using namespace std;
 
int n,m,curr,res[MAXN];
bool good[MAXN],special[MAXN],pr[MAXN];
vector<int> v[MAXN],ans;

vector<int> who_wins(vector<int> A,vector<int> R, vector<int> from,vector<int> to){
    n=int(A.size()); m=int(from.size());
    
    for(int i=0;i<n;i++){
        if(A[i]==1)good[i]=true;
        if(R[i]==1)special[i]=true;
    }

    for(int i=0;i<m;i++){
        if(from[i]==to[i])pr[from[i]]=true;
        v[from[i]].push_back(to[i]);
    }

    if(special[n-1])curr=1;
    else curr=0;
    
    for(int i=n-1;i>=0;i--){
        if(pr[i]){
            if(good[i] and special[i])curr=1;
            else if(!good[i] and !special[i])curr=0;
        }
        res[i]=curr;
    }

    for(int i=0;i<n;i++){
        ans.push_back(res[i]);
    }

    return ans;
}



# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 3028 KB Output is correct
2 Correct 5 ms 3156 KB Output is correct
3 Incorrect 5 ms 3156 KB 3rd lines differ - on the 355th token, expected: '1', found: '0'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2644 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 3284 KB Output is correct
2 Correct 7 ms 3412 KB Output is correct
3 Correct 8 ms 3412 KB Output is correct
4 Incorrect 8 ms 3412 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 3192 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 3352 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 3028 KB Output is correct
2 Correct 5 ms 3156 KB Output is correct
3 Incorrect 5 ms 3156 KB 3rd lines differ - on the 355th token, expected: '1', found: '0'
4 Halted 0 ms 0 KB -