Submission #1064007

# Submission time Handle Problem Language Result Execution time Memory
1064007 2024-08-18T07:46:59 Z Ignut Toy Train (IOI17_train) C++17
0 / 100
1100 ms 1372 KB
// Ignut

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int N = 5555;
int n, m;

vector<int> a, r;

vector<int> g[N];

bool ans = false;

int used[N];

int cntR[N];

int currR = 0;

void dfs(int v) {
    used[v] = 1;
    currR += r[v];
    cntR[v] = currR;
    for (int to : g[v]) {
        if (used[to] == 1) {
            if (cntR[to] != currR) ans = true;
        }
        else if (used[to] == 0) {
            dfs(to);
        }
    }
    used[v] = 2;
}

vector<int> who_wins(vector<int> A, vector<int> R, vector<int> u, vector<int> v) {
    n = A.size(), m = u.size();
    a = A, r = R;
    for (int i = 0; i < m; i ++) {
        g[u[i]].push_back(v[i]);
    }
    vector<int> res;
    for (int s = 0; s < n; s ++) {
        ans = false;
        for (int i = 0; i < n; i ++) used[i] = 0;
        dfs(s);
        res.push_back(ans);
    }
    return res;
}

# Verdict Execution time Memory Grader output
1 Incorrect 132 ms 1224 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 0 ms 348 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 125 ms 1372 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 780 ms 1116 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 1100 ms 1344 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 132 ms 1224 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -