Submission #1064161

# Submission time Handle Problem Language Result Execution time Memory
1064161 2024-08-18T09:45:28 Z Ignut Toy Train (IOI17_train) C++17
11 / 100
699 ms 1620 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];
bool good[N];

void dfs(int v) {
    used[v] = true;
    ans |= good[v];
    if (ans) return;
    for (int to : g[v])
        if (!used[to])
            dfs(to);
}

void dfs1(int v, int st) {
    if (good[st]) return;
    used[v] = true;
    for (int to : g[v]) {
        if (to == st) {
            good[st] = true; return;
        }
        if (!used[to]) dfs1(to, st);
    }
}

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]);
    }
    for (int i = 0; i < n; i ++) {
        if (r[i] == 0) continue;
        for (int j = 0; j < n; j ++) used[j] = false;
        dfs1(i, 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 48 ms 1116 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 Correct 107 ms 1616 KB Output is correct
2 Correct 109 ms 1620 KB Output is correct
3 Correct 118 ms 1620 KB Output is correct
4 Correct 122 ms 1620 KB Output is correct
5 Correct 64 ms 1572 KB Output is correct
6 Correct 362 ms 1468 KB Output is correct
7 Correct 102 ms 1396 KB Output is correct
8 Correct 77 ms 1460 KB Output is correct
9 Correct 135 ms 1372 KB Output is correct
10 Correct 54 ms 1372 KB Output is correct
11 Correct 72 ms 1380 KB Output is correct
12 Correct 16 ms 1368 KB Output is correct
13 Correct 641 ms 1576 KB Output is correct
14 Correct 699 ms 1588 KB Output is correct
15 Correct 654 ms 1616 KB Output is correct
16 Correct 25 ms 1368 KB Output is correct
17 Correct 149 ms 1508 KB Output is correct
18 Correct 231 ms 1308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 330 ms 1372 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 9 ms 1372 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 48 ms 1116 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -