Submission #1024985

# Submission time Handle Problem Language Result Execution time Memory
1024985 2024-07-16T13:43:51 Z c2zi6 Toy Train (IOI17_train) C++14
0 / 100
4 ms 1372 KB
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define replr(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define reprl(i, a, b) for (int i = int(a); i >= int(b); --i)
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define mkp(a, b) make_pair(a, b)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<VPI> VVPI;
typedef pair<ll, ll> PLL;
typedef vector<ll> VL;
typedef vector<PLL> VPL;
typedef vector<VL> VVL;
typedef vector<VVL> VVVL;
typedef vector<VPL> VVPL;
template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;}
template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;}
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T>
using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#include "train.h"

namespace TEST1 {
    bool check(VI U, VI V) {
        rep(i, U.size()) if (V[i] != U[i] && V[i] != U[i]+1) return false;
        return true;
    }
    VI solve(VVI gp, VI owner, VI charge) {
        int n = gp.size();
        VI ans(n);
        reprl(u, n-1, 0) {
            if (gp[u].size() == 2) {
                if (owner[u] == 1) {
                    if (charge[u] == 1) ans[u] = 1;
                    else for (int v : gp[u]) if (v != u) {
                        if (ans[v] == 1) ans[u] = 1;
                    }
                } else {
                    if (charge[u] == 0) ans[u] = 0;
                    else for (int v : gp[u]) if (v != u) {
                        if (ans[v] == 0) ans[u] = 0;
                    }
                }
            } else if (gp[u].size()) {
                if (gp[u][0] == u) {
                    ans[u] = (charge[u]);
                } else {
                    ans[u] = ans[gp[u][0]];
                }
            }
        }
        return ans;
    }
};
namespace TEST2 {
};
namespace TEST3 {
};
namespace TEST4 {
};

VI who_wins(VI owner, VI charge, VI U, VI V) {
    int n = owner.size();
    int m = U.size();
    VVI gp(n);
    rep(i, m) gp[U[i]].pb(V[i]);
    if (TEST1::check(U, V)) return TEST1::solve(gp, owner, charge);

	return {3, 1, 4};
}


# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1116 KB 3rd lines differ - on the 26th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB WA in grader: Wrong returned array size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1372 KB WA in grader: Wrong returned array size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1216 KB WA in grader: Wrong returned array size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1372 KB WA in grader: Wrong returned array size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1116 KB 3rd lines differ - on the 26th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -