Submission #293207

# Submission time Handle Problem Language Result Execution time Memory
293207 2020-09-07T18:35:58 Z eohomegrownapps Toy Train (IOI17_train) C++14
5 / 100
8 ms 768 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;

int n,m;
/*
vector<int> adjlist;
vector<int> revadjlist;

vector<int> status;

void dfs(int node){
	status[node]=1;
	for (int i : adjlist[node]){
		if (status[i]!=0){

		}
	}
	status[node]=2;
}

vector<int> aall(vector<int> &charging, vector<int> &u, vector<int> &v){
	adjlist.resize(n);
	for (int i = 0; i<m; i++){
		adjlist[u[i]].push_back(v[i]);
	}

	status.resize(n,0);
	for (int i = 0; i<m; i++){
		cycle
	}
}

vector<int> ball(vector<int> &charging, vector<int> &u, vector<int> &v){
	return vector<int>();
}*/

std::vector<int> who_wins(std::vector<int> aowns, std::vector<int> charging, std::vector<int> u, std::vector<int> v) {
	n=aowns.size();
	m=u.size();
	int numa = 0;
	for (int i : aowns){
		numa+=i;
	}
	/*if (numa==n){
		return aall(charging,u,v);
	}
	if (numa==0){
		return ball(charging,u,v);
	}*/

	vector<bool> iscycle(n);
	vector<bool> edgetonext(n,false);
	for (int i = 0; i<m; i++){
		if (u[i]==v[i]){
			iscycle[u[i]]=true;
		} else {
			edgetonext[u[i]]=true;
		}
	}
	vector<int> ans(n);
	for (int i = n-1; i>=0; i--){
		if (iscycle[i]){
			if (aowns[i]&&charging[i]){
				ans[i]=1;
			} else if ((!aowns[i])&&(!charging[i])){
				ans[i]=0;
			} else {
				if (!edgetonext[i]){
					if (charging[i]){
						ans[i]=1;
					} else {
						ans[i]=0;
					}
				} else {
					ans[i]=ans[i+1];
				}
			}
		} else {
			ans[i]=ans[i+1];
		}
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 512 KB Output is correct
2 Correct 4 ms 512 KB Output is correct
3 Correct 4 ms 640 KB Output is correct
4 Correct 4 ms 640 KB Output is correct
5 Correct 4 ms 640 KB Output is correct
6 Correct 4 ms 640 KB Output is correct
7 Correct 4 ms 640 KB Output is correct
8 Correct 4 ms 640 KB Output is correct
9 Correct 4 ms 640 KB Output is correct
10 Correct 4 ms 640 KB Output is correct
11 Correct 4 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 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 7 ms 768 KB Output is correct
2 Correct 7 ms 768 KB Output is correct
3 Correct 7 ms 768 KB Output is correct
4 Incorrect 7 ms 768 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 672 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 7 ms 768 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 512 KB Output is correct
2 Correct 4 ms 512 KB Output is correct
3 Correct 4 ms 640 KB Output is correct
4 Correct 4 ms 640 KB Output is correct
5 Correct 4 ms 640 KB Output is correct
6 Correct 4 ms 640 KB Output is correct
7 Correct 4 ms 640 KB Output is correct
8 Correct 4 ms 640 KB Output is correct
9 Correct 4 ms 640 KB Output is correct
10 Correct 4 ms 640 KB Output is correct
11 Correct 4 ms 632 KB Output is correct
12 Incorrect 0 ms 256 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -