Submission #1045812

# Submission time Handle Problem Language Result Execution time Memory
1045812 2024-08-06T07:53:16 Z LittleOrange Toy Train (IOI17_train) C++17
0 / 100
7 ms 1628 KB
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
using ll = int;
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
	ll n = a.size();
	ll m = u.size();
	std::vector<int> res(a.size());
	for(int i = 0; i < (int)res.size(); i++)
		res[i] = i % 2;
	vector<vector<ll>> con(n),rcon(n);
	for(ll i = 0;i<m;i++){
		con[u[i]].push_back(v[i]);
		rcon[v[i]].push_back(u[i]);
	}
	vector<ll> ans(n,0);
	for(ll i = 0;i<n;i++){
		if (a[i]&&r[i]){
			for(ll j : con[i]) if(j==i) ans[i] = 1;
		}
	}
	for(ll i = n-2;i>=0;i--){
		if (a[i]){
			for(ll j : con[i]) if(j==i+1&&ans[i+1]) ans[i] = 1;
		}else{
			ans[i] = 1;
			for(ll j : con[i]) {
				if(j==i&&!r[i]) ans[i] = 0;
				if(j==i+1&&!ans[i+1]) ans[i] = 0;
			}
		}
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1116 KB Output is correct
2 Incorrect 2 ms 1116 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 0 ms 348 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1372 KB Output is correct
2 Correct 3 ms 1628 KB Output is correct
3 Correct 3 ms 1624 KB Output is correct
4 Incorrect 7 ms 1628 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 1116 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1368 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1116 KB Output is correct
2 Incorrect 2 ms 1116 KB 3rd lines differ - on the 4997th token, expected: '1', found: '0'
3 Halted 0 ms 0 KB -