Submission #426533

# Submission time Handle Problem Language Result Execution time Memory
426533 2021-06-14T06:07:58 Z jeqcho Toy Train (IOI17_train) C++17
5 / 100
10 ms 972 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define F0R(i,b) FOR(i,0,b)
#define ROF(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define R0F(i,b) ROF(i,0,b)
#define all(x) begin(x),end(x)
#define sz(x) int(x.size())
#define pb push_back
#define rsz resize
#define trav(a,x) for(auto&a :x)
#define fi first
#define se second

int const N=5e3+3;
vi r;
int n,m;
bitset<N>c;

vi a;
bitset<N> nxt;
vi ans;

void dfs(int now)
{
	if(a[now])
	{
		//A
		if(r[now])
		{
			if(c[now])ans[now]=1;
			else ans[now]=ans[now+1];
		}
		else
		{
			if(nxt[now])ans[now]=ans[now+1];
			else ans[now]=0;
		}
	}
	else
	{
		if(!r[now])
		{
			if(c[now])ans[now]=0;
			else ans[now]=ans[now+1];
		}
		else
		{
			if(nxt[now])ans[now]=ans[now+1];
			else ans[now]=1;
		}
	}
}

vi who_wins(vi a1, vi r1, vi u, vi v) {
	a=a1;
	n=sz(a);
	m=sz(u);
	r=r1;
	F0R(i,m)
	{
		if(v[i]==u[i])
		{
			c[u[i]]=1;
		}
		else
		{
			nxt[u[i]]=1;
		}
	}
	ans.rsz(n);
	R0F(i,n)
	{
		dfs(i);
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 588 KB Output is correct
2 Correct 4 ms 568 KB Output is correct
3 Correct 4 ms 560 KB Output is correct
4 Correct 4 ms 588 KB Output is correct
5 Correct 4 ms 600 KB Output is correct
6 Correct 4 ms 588 KB Output is correct
7 Correct 4 ms 588 KB Output is correct
8 Correct 4 ms 588 KB Output is correct
9 Correct 4 ms 588 KB Output is correct
10 Correct 5 ms 568 KB Output is correct
11 Correct 4 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 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 6 ms 972 KB Output is correct
2 Correct 10 ms 972 KB Output is correct
3 Correct 7 ms 972 KB Output is correct
4 Incorrect 6 ms 948 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 8 ms 844 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 10 ms 972 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 Correct 4 ms 588 KB Output is correct
2 Correct 4 ms 568 KB Output is correct
3 Correct 4 ms 560 KB Output is correct
4 Correct 4 ms 588 KB Output is correct
5 Correct 4 ms 600 KB Output is correct
6 Correct 4 ms 588 KB Output is correct
7 Correct 4 ms 588 KB Output is correct
8 Correct 4 ms 588 KB Output is correct
9 Correct 4 ms 588 KB Output is correct
10 Correct 5 ms 568 KB Output is correct
11 Correct 4 ms 588 KB Output is correct
12 Incorrect 1 ms 204 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -