Submission #583940

# Submission time Handle Problem Language Result Execution time Memory
583940 2022-06-26T14:11:30 Z PiejanVDC Toy Train (IOI17_train) C++17
0 / 100
806 ms 1048 KB
#include <bits/stdc++.h>
#include "train.h"

using namespace std;

const int mxN = (int)5005;

vector<int>adj[mxN];

vector<int>who_wins(vector<int>a, vector<int>r, vector<int>u, vector<int>v) {

    int n = r.size();
    int m = u.size();

    for(int i = 0 ; i < m ; i++) {
        adj[u[i]].push_back(v[i]);
    }


    vector<int>ans(n,0);
    for(int i = 0 ; i < n ; i++) {
        vector<bool>vis(n,0);
        vis[i] = 1;
        stack<int>s;
        s.push(i);
        while(!s.empty()) {
            int node = s.top();
            s.pop();
            if(r[node])
                ans[i] = 1;
            for(auto z : adj[node]) if(!vis[z]) {
                vis[z] = 1;
                s.push(z);
            }
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 189 ms 752 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 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 146 ms 1048 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 640 ms 904 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 806 ms 1032 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 189 ms 752 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -