Submission #585233

#TimeUsernameProblemLanguageResultExecution timeMemory
585233VanillaToy Train (IOI17_train)C++17
5 / 100
39 ms752 KiB
#include <bits/stdc++.h>
#include "train.h"
using namespace std;

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	int n = a.size(), m = u.size();
	vector <int> has_self (n);
	vector <int> has_next (n);
	vector <int> rs (n, 0);
	for (int i = 0; i < m; i++){
		if (u[i] == v[i]) has_self[u[i]] = 1;
		else has_next[u[i]] = 1;
	}
	for (int i = 0; i < n; i++){
		for (int j = i; j < n; j++) {
			if (r[j] && ((has_self[j] && a[j]) || (!has_next[j] && has_self[j] && !a[j]))) {
				rs[i] = 1;
				break;
			}
			if (has_self[j] && !a[j] && !r[j]) break;
			if (!has_next[j] && a[j]) break;
		}
	}
	return rs;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...