Submission #296091

# Submission time Handle Problem Language Result Execution time Memory
296091 2020-09-10T09:05:05 Z Muhammetali Toy Train (IOI17_train) C++11
0 / 100
2000 ms 1920 KB
#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(a.size());
	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 (s[i].count(i)==1)
		{
			if (a[i]==0 && r[i]==0) g.pb(i);
			if (r[i]==1 && a[i]==1)gg.pb(i);
		}
	}
	for (int i=0;i<sz(a);i++)
	{
		ll k=i;
		ll jem=0;
		while(sz(s[k])==2)
		{
			if (g.front()==k)
			{
				jem=1;
				g.pop_front();
				break;
			}
			if (gg.front()==k)
			{
				jem=1;
				gg.pop_front();
				break;
			}
		}
		res.pb(jem);
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2058 ms 1152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2073 ms 640 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2098 ms 1920 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2083 ms 1664 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2069 ms 1920 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2058 ms 1152 KB Time limit exceeded
2 Halted 0 ms 0 KB -