# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
660950 |
2022-11-23T17:45:32 Z |
urosk |
Toy Train (IOI17_train) |
C++14 |
|
18 ms |
1332 KB |
#include "train.h"
#define dbg(x) cerr<<#x<<": "<<x<<endl
#define here cerr<<"===================================\n"
#include <bits/stdc++.h>
#define ll int
#define sz(a) (ll)(a.size())
#define pb push_back
#define popb pop_back
#define all(a) a.begin(),a.end()
#define llinf 1000000000LL
#define fi first
#define sc second
#define pll pair<ll,ll>
#define endl '\n'
#define ceri(a,l,r) {cerr<<#a<<": ";for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
using namespace std;
#define maxn 5005
ll n,m;
vector<ll> ans;
vector<ll> g[maxn];
vector<ll> cur;
bool c[maxn];
bool vis[maxn];
bool naso = 0;
void dfs(ll u,ll p){
vis[u] = 1;
for(ll s : g[u]){
if(s==p) continue;
if(c[s]) continue;
if(vis[s]){
naso = 1;
return;
}
dfs(s,u);
if(naso) return;
}
}
vector<int> who_wins(vector<int> a,vector<int> r,vector<int> u,vector<int> v) {
reverse(all(u)); u.pb(-1); reverse(all(u));
reverse(all(v)); v.pb(-1); reverse(all(v));
reverse(all(r)); r.pb(-1); reverse(all(r));
ll sum = 0; for(ll x : a) sum+=x;
n = sz(a);
m = sz(u)-1;
for(ll i = 1;i<=n;i++) c[i] = r[i];
ceri(c,1,n);
for(ll i = 1;i<=m;i++){
u[i]++; v[i]++;
ll x = u[i]; ll y = v[i];
g[x].pb(y);
g[y].pb(x);
}
if(sum==0){
for(ll i = 1;i<=n;i++){
if(c[i]) continue;
for(ll j = 1;j<=n;j++) vis[j] = 0;
dfs(i,i);
if(naso) break;
}
for(ll i = 1;i<=n;i++) ans.pb(naso);
return ans;
}
return {};
}
/*
4 6
0 0 0 0
0 1 0 0
0 1
0 2
0 3
1 2
1 3
2 3
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
852 KB |
WA in grader: Wrong returned array size |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
WA in grader: Wrong returned array size |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
1316 KB |
WA in grader: Wrong returned array size |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
1148 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 |
18 ms |
1332 KB |
WA in grader: Wrong returned array size |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
852 KB |
WA in grader: Wrong returned array size |
2 |
Halted |
0 ms |
0 KB |
- |