#include "train.h"
#include <bits/stdc++.h>
#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v)
{
vi res,yol[6000];
int mx=0,mxx=0;
for (int i=0;i<sz(u);i++)
{
yol[u[i]].pb(v[i]);
}
for (int i=0;i<sz(a);i++)
{
if (a[i]==0 && r[i]==0)
{
bool b=0;
for (int j=0;j<sz(yol[i]);j++)
{
if (yol[i][j]==i)
{
b=1;
break;
}
}
if (b)
{
mxx=max(mxx,i);
}
}
}
for (int i=0;i<sz(u);i++)
{
if (u[i]==v[i] && a[u[i]]==1 && r[u[i]]==1)
{
mx=max(mx,u[i]);
}
if (yol[u[i]].size()==1 && yol[u[i]][0]==u[i] && r[u[i]]==1)
{
mx=max(mx,u[i]);
}
}
for (int i=0;i<sz(a);i++)
{
if (mxx>=i)res.pb(0);
else if (mx>=i)
{
res.pb(1);
}
else
{
res.pb(0);
}
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
896 KB |
3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 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 |
12 ms |
1152 KB |
Output is correct |
2 |
Correct |
8 ms |
1152 KB |
Output is correct |
3 |
Correct |
8 ms |
1152 KB |
Output is correct |
4 |
Incorrect |
9 ms |
1152 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 |
1024 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 |
9 ms |
1152 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 |
5 ms |
896 KB |
3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |