Submission #1045857

# Submission time Handle Problem Language Result Execution time Memory
1045857 2024-08-06T08:09:34 Z LittleOrange Toy Train (IOI17_train) C++17
5 / 100
4 ms 1396 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-1;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 1112 KB Output is correct
2 Correct 2 ms 1112 KB Output is correct
3 Correct 2 ms 1116 KB Output is correct
4 Correct 2 ms 1036 KB Output is correct
5 Correct 3 ms 1116 KB Output is correct
6 Correct 2 ms 1116 KB Output is correct
7 Correct 2 ms 1116 KB Output is correct
8 Correct 2 ms 1116 KB Output is correct
9 Correct 2 ms 1112 KB Output is correct
10 Correct 2 ms 1116 KB Output is correct
11 Correct 3 ms 1116 KB Output is correct
# 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 3 ms 1372 KB Output is correct
2 Correct 3 ms 1372 KB Output is correct
3 Correct 3 ms 1372 KB Output is correct
4 Incorrect 4 ms 1396 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 4 ms 1112 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 1372 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 1112 KB Output is correct
2 Correct 2 ms 1112 KB Output is correct
3 Correct 2 ms 1116 KB Output is correct
4 Correct 2 ms 1036 KB Output is correct
5 Correct 3 ms 1116 KB Output is correct
6 Correct 2 ms 1116 KB Output is correct
7 Correct 2 ms 1116 KB Output is correct
8 Correct 2 ms 1116 KB Output is correct
9 Correct 2 ms 1112 KB Output is correct
10 Correct 2 ms 1116 KB Output is correct
11 Correct 3 ms 1116 KB Output is correct
12 Incorrect 0 ms 348 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
13 Halted 0 ms 0 KB -