# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
139488 | arthurconmy | Toy Train (IOI17_train) | C++14 | 2074 ms | 892 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#ifndef ARTHUR_LOCAL
#include "train.h"
#endif
using namespace std;
const int MAXN = 5000;
bool is_loop[MAXN];
bool go_next[MAXN];
vector<int> who_wins(vector<int> A, vector<int> R, vector<int> U, vector<int> V)
{
int n = A.size();
int m = V.size();
for(int i=0; i<m; i++)
{
if(U[i]==V[i]) is_loop[U[i]]=1;
else go_next[min(U[i],V[i])]=1;
}
vector<int> ans;
for(int i=0; i<n; i++)
{
int cur=i;
while(true)
{
if(is_loop[cur] && A[cur] && R[cur]) ans.push_back(1);
if(is_loop[cur] && !A[cur] && !R[cur]) ans.push_back(0);
if(ans.size()==i+1) break;
if(!go_next[cur]) ans.push_back(R[cur]);
if(ans.size()==i+1) break;
cur=go_next[cur];
}
}
return ans;
}
#ifdef ARTHUR_LOCAL
int main()
{
cout << "ppop" << endl;
}
#endif
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |