Submission #671493

# Submission time Handle Problem Language Result Execution time Memory
671493 2022-12-13T06:00:15 Z coding_snorlax Toy Train (IOI17_train) C++14
0 / 100
1101 ms 1252 KB
#include<bits/stdc++.h>
#include "train.h"
using namespace std;
#define pb push_back
int vis[5005]={0};
vector<int> answer;
vector<int> G[5005];
int charge[5005]={0};
int flag=0;
void dfs(int node){
    vis[node]=1;
    if(charge[node]) flag=1;
    for(int i:G[node]){
        if(!vis[i]) dfs(i);
    }
}
vector<int> who_wins(vector<int> a,vector<int> r,vector<int> u,vector<int> v){
    for(int i=0;i<(int)r.size();i++){
        charge[i]=r[i];
    }
    for(int i=0;i<(int)u.size();i++){
        G[u[i]].push_back(v[i]);
    }
    for(int i=0;i<(int)a.size();i++){
        flag=0;
        for(int j=0;j<(int)a.size();j++){
            vis[j]=0;
        }
        dfs(i);
        if(flag) answer.pb(1);
        else answer.pb(0);
    }
    for(int i=0;i<(int)a.size();i++){
        //cout<<"ok";
        for(int j=0;j<(int)a.size();j++){
            int flag2=0;
            for(int k:G[j]){
                if(answer[k]!=0) flag2=1;
            }
            if(!flag2) answer[j]=0;
        }
    }
    return answer;

}
# Verdict Execution time Memory Grader output
1 Incorrect 259 ms 944 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 254 ms 1252 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 834 ms 1040 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1101 ms 1252 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 259 ms 944 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -