Submission #56624

# Submission time Handle Problem Language Result Execution time Memory
56624 2018-07-12T03:34:40 Z Crown Toy Train (IOI17_train) C++14
5 / 100
26 ms 2616 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v)
{
	vector<int> has_cycle;
	vector<int> ending;
	int n = a.size();
	int m = u.size();
	ending.assign(n, 1);
	has_cycle.assign(n, 0);
	for(int i = 0; i< (int) m; i++)
	{
		if(u[i] != v[i])
			ending[u[i]] = false;
		else
			has_cycle[u[i]] = true;
	}
	vector<int> res(n);
	for(int i = n-1; i>= 0; i--)
	{
		if(a[i])
		{
			if(has_cycle[i])
			{
				if(r[i])
					res[i] = true;
				else
				{
					if(ending[i]) 
						res[i] = false;
					else 
						res[i] = res[i+1];
				}
			}
			else
				res[i] = res[i+1];
		}
		else
		{
			if(has_cycle[i])
			{
				if(!r[i])
					res[i] = false;
				else
				{
					if(ending[i])
						res[i] = true;
					else
						res[i] = res[i+1];
				}
			}
			else
				res[i] = res[i+1];
		}
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 612 KB Output is correct
2 Correct 10 ms 1064 KB Output is correct
3 Correct 8 ms 1064 KB Output is correct
4 Correct 7 ms 1064 KB Output is correct
5 Correct 9 ms 1156 KB Output is correct
6 Correct 9 ms 1280 KB Output is correct
7 Correct 6 ms 1356 KB Output is correct
8 Correct 13 ms 1440 KB Output is correct
9 Correct 26 ms 1652 KB Output is correct
10 Correct 6 ms 1652 KB Output is correct
11 Correct 6 ms 1760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1760 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 10 ms 1940 KB Output is correct
2 Correct 9 ms 2328 KB Output is correct
3 Correct 10 ms 2408 KB Output is correct
4 Incorrect 9 ms 2616 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 2616 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 2616 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 7 ms 612 KB Output is correct
2 Correct 10 ms 1064 KB Output is correct
3 Correct 8 ms 1064 KB Output is correct
4 Correct 7 ms 1064 KB Output is correct
5 Correct 9 ms 1156 KB Output is correct
6 Correct 9 ms 1280 KB Output is correct
7 Correct 6 ms 1356 KB Output is correct
8 Correct 13 ms 1440 KB Output is correct
9 Correct 26 ms 1652 KB Output is correct
10 Correct 6 ms 1652 KB Output is correct
11 Correct 6 ms 1760 KB Output is correct
12 Incorrect 2 ms 1760 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -