Submission #428480

# Submission time Handle Problem Language Result Execution time Memory
428480 2021-06-15T12:10:33 Z yuto1115 Toy Train (IOI17_train) C++17
5 / 100
9 ms 1228 KB
#include "train.h"
#include<bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, s, n) for(ll i = ll(s); i < ll(n); i++)
#define rrep(i, n) for(ll i = ll(n)-1; i >= 0; i--)
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vp = vector<P>;
using vvp = vector<vp>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vs = vector<string>;
const int inf = 1001001001;
const ll linf = 1001001001001001001;

template<class T>
bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

vi who_wins(vi a, vi r, vi u, vi v) {
    int n = a.size();
    int m = u.size();
    vvi G(n);
    rep(i, m) G[u[i]].pb(v[i]);
    vi dp(n);
    rrep(i, n) {
        if (a[i]) {
            for (int j : G[i]) {
                if (i == j) dp[i] |= r[i];
                else dp[i] |= dp[j];
            }
        } else {
            dp[i] = 1;
            for (int j : G[i]) {
                if (i == j) dp[i] &= r[i];
                else dp[i] &= dp[j];
            }
        }
    }
    return dp;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 844 KB Output is correct
2 Correct 5 ms 844 KB Output is correct
3 Correct 5 ms 844 KB Output is correct
4 Correct 5 ms 804 KB Output is correct
5 Correct 4 ms 844 KB Output is correct
6 Correct 4 ms 844 KB Output is correct
7 Correct 5 ms 844 KB Output is correct
8 Correct 5 ms 844 KB Output is correct
9 Correct 4 ms 844 KB Output is correct
10 Correct 4 ms 716 KB Output is correct
11 Correct 4 ms 692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1228 KB Output is correct
2 Correct 9 ms 1200 KB Output is correct
3 Correct 9 ms 1228 KB Output is correct
4 Incorrect 8 ms 1228 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 964 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 1228 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 844 KB Output is correct
2 Correct 5 ms 844 KB Output is correct
3 Correct 5 ms 844 KB Output is correct
4 Correct 5 ms 804 KB Output is correct
5 Correct 4 ms 844 KB Output is correct
6 Correct 4 ms 844 KB Output is correct
7 Correct 5 ms 844 KB Output is correct
8 Correct 5 ms 844 KB Output is correct
9 Correct 4 ms 844 KB Output is correct
10 Correct 4 ms 716 KB Output is correct
11 Correct 4 ms 692 KB Output is correct
12 Incorrect 1 ms 204 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -