Submission #585223

#TimeUsernameProblemLanguageResultExecution timeMemory
585223Vanilla장난감 기차 (IOI17_train)C++17
0 / 100
14 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 (has_self[j] && a[j] && r[j]) {
				rs[i] = 1;
				break;
			}
			if (!has_next[j] && !a[j] && r[j]) {
				rs[i] = 1;
				break;
			}
			if (has_self[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...