답안 #757161

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
757161 2023-06-12T17:58:04 Z alexander707070 장난감 기차 (IOI17_train) C++14
5 / 100
7 ms 3160 KB
#include<bits/stdc++.h>
#define MAXN 100007
using namespace std;
 
int n,m,curr,res[MAXN];
bool good[MAXN],special[MAXN],pr[MAXN],nxt[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;
        else nxt[from[i]]=true;
    }

    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;

        if(i>0 and !nxt[i-1]){
            if(special[i-1])curr=1;
            else curr=0;
        }
    }

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

    return ans;
}



# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2900 KB Output is correct
2 Correct 4 ms 2872 KB Output is correct
3 Correct 4 ms 2900 KB Output is correct
4 Correct 4 ms 3028 KB Output is correct
5 Correct 4 ms 3028 KB Output is correct
6 Correct 6 ms 2924 KB Output is correct
7 Correct 5 ms 2900 KB Output is correct
8 Correct 4 ms 3028 KB Output is correct
9 Correct 5 ms 2932 KB Output is correct
10 Correct 5 ms 2928 KB Output is correct
11 Correct 4 ms 2900 KB Output is correct
# 결과 실행 시간 메모리 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 3104 KB Output is correct
2 Correct 6 ms 3156 KB Output is correct
3 Correct 7 ms 3160 KB Output is correct
4 Incorrect 7 ms 3092 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 3028 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 3028 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2900 KB Output is correct
2 Correct 4 ms 2872 KB Output is correct
3 Correct 4 ms 2900 KB Output is correct
4 Correct 4 ms 3028 KB Output is correct
5 Correct 4 ms 3028 KB Output is correct
6 Correct 6 ms 2924 KB Output is correct
7 Correct 5 ms 2900 KB Output is correct
8 Correct 4 ms 3028 KB Output is correct
9 Correct 5 ms 2932 KB Output is correct
10 Correct 5 ms 2928 KB Output is correct
11 Correct 4 ms 2900 KB Output is correct
12 Incorrect 2 ms 2644 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -