#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;
}
int n;
VVI gp;
VI charge;
VI ans;
int get(int u) {
if (ans[u] != -1) return ans[u];
if (gp[u][0] == u) {
if (charge[u]) return ans[u] = 1;
return ans[u] = 0;
}
return ans[u] = get(gp[u][0]);
}
VI solve(VVI GP, VI CHARGE) {
gp = GP;
charge = CHARGE;
n = gp.size();
ans = VI(n, -1);
rep(u, n) get(u);
return ans;
}
};
namespace TEST2 {
};
namespace TEST3 {
};
namespace TEST4 {
};
VI who_wins(VI owner, VI charge, VI U, VI V) {
VVI gp(owner.size());
rep(i, U.size()) gp[U[i]].pb(V[i]);
if (TEST1::check(U, V)) return TEST1::solve(gp, charge);
return {3, 1, 4};
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
1368 KB |
3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
WA in grader: Wrong returned array size |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
1372 KB |
WA in grader: Wrong returned array size |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
1112 KB |
WA in grader: Wrong returned array size |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
1372 KB |
WA in grader: Wrong returned array size |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
1368 KB |
3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |