Submission #1310006

#TimeUsernameProblemLanguageResultExecution timeMemory
1310006lnw143Toy Train (IOI17_train)C++17
Compilation error
0 ms0 KiB
#include "train.h"

#include <bits/stdc++.h>

using namespace std;

using vi=vector<int>;

const int N=5005;

int n,m;

vi who_wins(vi a,vi r,vi u,vi v) {
	n=a.size(),m=u.size();
	const auto check1=[&]() {
		for(int i=0; i<m; ++i) if(u[i]!=v[i]&&u[i]+1!=v[i]) return 0;
		return 1;
	};
	if(check1()) {
		static int bz[N];
		for(int i=0; i<m; ++i) if(u[i]==v[i]) bz[i]|=1; else bz[i]|=2;
		vi ans(n,0);
		for(int i=n-1; i>=0; --i) {
			if((a[i]==r[i]&&(b[i]&1))||(~bz[i]&2)) ans[i]=r[i];
			else ans[i]=ans[i+1];
		}
		return ans;
	}
	return res;
}

Compilation message (stderr)

train.cpp: In function 'vi who_wins(vi, vi, vi, vi)':
train.cpp:24:42: error: 'b' was not declared in this scope
   24 |                         if((a[i]==r[i]&&(b[i]&1))||(~bz[i]&2)) ans[i]=r[i];
      |                                          ^
train.cpp:29:16: error: 'res' was not declared in this scope
   29 |         return res;
      |                ^~~