제출 #1051566

#제출 시각아이디문제언어결과실행 시간메모리
1051566MarwenElarbi열쇠 (IOI21_keys)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

std::vector<int> find_reachable(std::vector<int> r, std::vector<int> u, std::vector<int> v, std::vector<int> c) {
	std::vector<int> ans(r.size(),1);
	int cnt=0;
	for (int i = 0; i < (int)r.size(); ++i)
	{
		cnt+=(r[i]==0);
	}
	if(cnt==n||cnt==0) return ans;
	for (int i = 0; i < (int)r.size(); ++i)
	{
		if(r[i]==0) ans[i]=0; 
	}
	return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

keys.cpp: In function 'std::vector<int> find_reachable(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
keys.cpp:11:10: error: 'n' was not declared in this scope
   11 |  if(cnt==n||cnt==0) return ans;
      |          ^