Submission #409795

# Submission time Handle Problem Language Result Execution time Memory
409795 2021-05-21T14:41:57 Z dreezy Toy Train (IOI17_train) C++17
0 / 100
8 ms 716 KB
#include <bits/stdc++.h>
using namespace std;

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u , vector<int> v){
	int n = a.size();
	int m = u.size();
	
	vector<int > w(n);
	vector<int> iscycle(n, 0);
	
	for(int i =0; i< m; i++){
		if(u[i] == v[i]){
			iscycle[i] = true;
		}
	}
	for(int i =0; i< n; i++){
		int winner = 0;
		int energy = n;
		
		int curstation = i;
		while(curstation < n){
			if(a[i] && iscycle[i] && r[i]){//arezou owns
			winner = 1;
			break;
			}
			
			else if(!a[i] && iscycle[i] && !r[i] ){
				winner = 0;
				break;
			}
			if(energy == 0){
				winner = 0;
				break;
			}
			energy--;
			curstation++;
		}
		
		for(i = i; i<= min(curstation, n-1); i++){
			w[i] = winner;
		}		
	}
	
	return w;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 460 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 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 Incorrect 6 ms 676 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 588 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 716 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 3 ms 460 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -