Submission #137226

#TimeUsernameProblemLanguageResultExecution timeMemory
137226MAMBAToy Train (IOI17_train)C++17
5 / 100
11 ms1144 KiB
#include "train.h"
#include <bits/stdc++.h>

using namespace std;

#define rep(i , j ,k) for(int i = j; i < (int)k; i++)
#define pb push_back

typedef vector<int> vi;

const int N = 5010;
vi adj[N];

std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
	
	int n = a.size();

	int m = u.size();

	rep(i , 0 , m)
		adj[u[i]].pb(v[i]);

	bool Bo = false;
	bool Ar = false;

	rep(i , 0 , n) {
		if (a[i]) Ar = true;
		else Bo = true;
	}

	if (Bo == false) {
		;
	}

	vi res(n);
	for (int i = n - 1; ~i; i--) {
		bool A = false;
		bool B = false;
		for (auto e : adj[i]) {
			if (i == e) {
				if (r[i])
					A = true;
				else 
					B = true;
			}
			else {
				if (res[e])
					A = true;
				else
					B = true;
			}
		}
		if (a[i] && A) res[i] = true;
		if (!a[i] && !B) res[i] = true;
	}

	return res;
}

Compilation message (stderr)

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:24:7: warning: variable 'Ar' set but not used [-Wunused-but-set-variable]
  bool Ar = false;
       ^~
#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...