#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;
deque<int>g,gg;
set<int>s[6000];
for (int i=0;i<sz(u);i++)s[u[i]].ins(v[i]);;
for (int i=0;i<sz(a);i++)
{
if (a[i]==0 && r[i]==0 && s[i].count(i)==1) g.pb(i);
}
for (int i=0;i<sz(u);i++)
{
if (u[i]==v[i] && a[u[i]]==1 && r[u[i]]==1)gg.pb(u[i]);
if (s[u[i]].size()==1 && s[u[i]].count(u[i])==1 && r[u[i]]==1)gg.pb(u[i]);
}
for (int i=0;i<sz(a);i++)
{
while(i>g.front())g.pop_front();
while(i>gg.front())gg.pop_front();
if (g.front()<gg.front())res.pb(0);
else res.pb(1);
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
6 ms |
2176 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
1024 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
11 ms |
3840 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
12 ms |
3072 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
11 ms |
3712 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
6 ms |
2176 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |