답안 #390279

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
390279 2021-04-15T18:14:24 Z Keshi 장난감 기차 (IOI17_train) C++17
컴파일 오류
0 ms 0 KB
//In the name of God
#include <bits/stdc++.h>
#include "train.h"
using namespace std;

typedef int ll;
typedef pair<ll, ll> pll;

const ll maxn = 5100;
const ll mod = 1e9 + 7;
const ll inf = 1e9;

#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io freopen("input.txt", "r+", stdin);freopen("output.txt", "w+", stdout);
#define pb push_back
#define Mp make_pair
#define F first
#define S second
#define Sz(x) ll((x).size())
#define all(x) (x).begin(), (x).end()

ll n, m;
vector<ll> g[maxn], gp[maxn];
ll ok[maxn][maxn], cnt[maxn], q[maxn], w[maxn];

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> v, vector<int> u){
	n = Sz(a);
	m = Sz(v);
	vector<int> res(n), res2(n);
	for(ll i = 0; i < m; i++){
		g[v[i]].pb(u[i]);
		gp[u[i]].pb(v[i]);
	}
	for(ll i = 0; i < n; i++){
		if(!r[i]) continue;
		fill(cnt, cnt + maxn, 0);
		ll l = 0, r = 0;
		ok[i][q[r++] = i] = 1;
		while(l < r){
			ll v = q[l++];
			for(ll u : gp[v]){
				cnt[u]++;
				if(ok[i][u]) continue;
				if(a[u]) ok[Qi][q[r++] = u] = 1;
				else if(cnt[u] == Sz(g[u])) ok[i][q[r++] = u] = 1;
			}
		}
		if(a[i]){
			if(cnt[i]) w[i] = 1;
		}
		else{
			if(cnt[i] == Sz(g[i])) w[i] = 1;
		}
	}
	fill(cnt, cnt + n, 0);
	ll l = 0, qr = 0;
	for(ll i = 0; i < n; i++){
		if(w[i]){
			res[q[qr++] = i] = 1;
			continue;
		}
		if(!r[i]) continue;
		for(ll j : g[i]){
			if(i == j) cnt[i]++;
		}
		if(cnt[i] == Sz(g[i]) || (a[i] && cnt[i])) res[q[qr++] = i] = 1;
	}
	while(l < qr){
		ll v = q[l++];
		for(ll u : gp[v]){
			cnt[u]++;
			if(res[u]) continue;
			if(a[u] || cnt[u] == Sz(g[u])) res[q[qr++] = u] = 1;
		}
	}
	return res;
}

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:44:17: error: 'Qi' was not declared in this scope; did you mean 'i'?
   44 |     if(a[u]) ok[Qi][q[r++] = u] = 1;
      |                 ^~
      |                 i