Submission #733365

# Submission time Handle Problem Language Result Execution time Memory
733365 2023-04-30T14:56:51 Z t6twotwo Toy Train (IOI17_train) C++17
5 / 100
7 ms 724 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> who_wins(vector<int> A, vector<int> R, vector<int> U, vector<int> V) {
    int N = A.size();
    int M = U.size();
    vector<int> adj(N);
    for (int i = 0; i < M; i++) {
        adj[U[i]] |= 1 << (V[i] - U[i]);
    }
    vector<int> ans(N);
    for (int i = 0; i < N; i++) {
        auto dfs = [&](auto dfs, int x) -> int {
            if (adj[x] / 1 % 2 == 1) {
                if (A[x] == R[x]) {
                    return A[x];
                }
            }
            if (adj[x] / 2 % 2 == 1) {
                if (dfs(dfs, x + 1) == A[x]) {
                    return A[x];
                }
            }
            return 1 - A[x];
        };
        ans[i] = dfs(dfs, i);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 516 KB Output is correct
2 Correct 5 ms 596 KB Output is correct
3 Correct 4 ms 568 KB Output is correct
4 Correct 4 ms 596 KB Output is correct
5 Correct 4 ms 572 KB Output is correct
6 Correct 3 ms 596 KB Output is correct
7 Correct 3 ms 596 KB Output is correct
8 Correct 4 ms 572 KB Output is correct
9 Correct 3 ms 596 KB Output is correct
10 Correct 3 ms 568 KB Output is correct
11 Correct 3 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 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 5 ms 724 KB 3rd lines differ - on the 1231st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 596 KB 3rd lines differ - on the 183rd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 724 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 Correct 3 ms 516 KB Output is correct
2 Correct 5 ms 596 KB Output is correct
3 Correct 4 ms 568 KB Output is correct
4 Correct 4 ms 596 KB Output is correct
5 Correct 4 ms 572 KB Output is correct
6 Correct 3 ms 596 KB Output is correct
7 Correct 3 ms 596 KB Output is correct
8 Correct 4 ms 572 KB Output is correct
9 Correct 3 ms 596 KB Output is correct
10 Correct 3 ms 568 KB Output is correct
11 Correct 3 ms 468 KB Output is correct
12 Incorrect 0 ms 212 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
13 Halted 0 ms 0 KB -