Submission #297132

# Submission time Handle Problem Language Result Execution time Memory
297132 2020-09-11T09:29:50 Z Autoratch Toy Train (IOI17_train) C++14
0 / 100
1059 ms 1280 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;

const int N = 5000;

int n,m;
vector<int> adj[N];
bool sm[N],nxt[N];
bool visited[N];

void dfs(int u)
{
    if(visited[u]) return;
    visited[u] = true;
    for(int v : adj[u]) dfs(v);
}

std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) 
{
    n = a.size(),m = u.size();
    for(int i = 0;i < m;i++)
    {
        adj[u[i]].push_back(v[i]);
        if(u[i]==v[i]) sm[u[i]] = true;
        else nxt[u[i]] = true;
    }
    vector<int> ans(n);
    for(int i = 0;i < n;i++)
    {
        for(int j = 0;j < n;j++) visited[j] = false;
        dfs(i);
        for(int j = 0;j < n;j++) if(r[j] and visited[j]) ans[i] = 1;
    }
    /*
    for(int i = n-1;i >= 0;i--)
    {
        if(!nxt[i] and !sm[i]){ ans[i] = 0; continue; }
        if(a[i] and r[i] and sm[i]) ans[i] = 1;
        else if(a[i]) 
        {
            if(nxt[i]) ans[i] = ans[i+1];
            else ans[i] = 0;
        }
        else 
        {
            if(!r[i] and sm[i]) ans[i] = 0;
            else if(sm[i] and !nxt[i]) ans[i] = 1;
            else if(!nxt[i]) ans[i] = 0;
            else ans[i] = ans[i+1];
        }
    }*/
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 301 ms 1132 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 384 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 215 ms 1280 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 863 ms 1144 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 1059 ms 1272 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 301 ms 1132 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -