Submission #293206

# Submission time Handle Problem Language Result Execution time Memory
293206 2020-09-07T18:34:45 Z eohomegrownapps Toy Train (IOI17_train) C++14
0 / 100
8 ms 896 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[u[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 640 KB Output is correct
2 Incorrect 4 ms 512 KB 3rd lines differ - on the 4997th token, expected: '1', found: '0'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 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 896 KB Output is correct
2 Correct 7 ms 896 KB Output is correct
3 Correct 8 ms 896 KB Output is correct
4 Incorrect 7 ms 896 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 6 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 Incorrect 8 ms 896 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 640 KB Output is correct
2 Incorrect 4 ms 512 KB 3rd lines differ - on the 4997th token, expected: '1', found: '0'
3 Halted 0 ms 0 KB -