Submission #1037516

# Submission time Handle Problem Language Result Execution time Memory
1037516 2024-07-29T02:48:30 Z thinknoexit Toy Train (IOI17_train) C++17
Compilation error
0 ms 0 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 5050;
vector<int> adj[N];
int n, m;
vector<int> who_wins(vector<int> a, vector<int> r, vector<int>  _U, vector<int> _V) {
	n = a.size();
	m = u.size();
	for (int i = 0;i < m;i++) {
		adj[_U[i]].push_back(_V[i]);
	}
	vector<int> ans(n);
	ans[n - 1] = r[n - 1];
	for (int i = n - 2;i >= 0;i--) {
		if (a[i] == 0) { // Borzou
			bool ch = 0;
			for (auto& x : adj[i]) {
				if (x == i && !r[i]) ch = 1;
				else if (!ans[x]) ch = 1;
			}
			ans[i] = ch ^ 1;
		}
		else { // Arezou
			bool ch = 0;
			for (auto& x : adj[i]) {
				if (x == i && r[i]) ch = 1
				else if (ans[x]) ch = 1;
			}
			ans[i] = ch;
		}
	}
	return ans;
}

Compilation message

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:10:6: error: 'u' was not declared in this scope
   10 |  m = u.size();
      |      ^
train.cpp:28:31: error: expected ';' before 'else'
   28 |     if (x == i && r[i]) ch = 1
      |                               ^
      |                               ;
   29 |     else if (ans[x]) ch = 1;
      |     ~~~~