제출 #522238

#제출 시각아이디문제언어결과실행 시간메모리
522238amunduzbaevCONSUL (info1cup19_consul)C++17
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h"
using namespace std;
#include "grader.h"

#ifndef EVAL
#include "grader.cpp"
#endif

void solve(int n){
	if(n <= 50){
		map<int, int> mm;
		for(int i=1;i<=n;i++){
			a[i] = kth(i);
			mm[a[i]]++;
		}
		
		for(auto x : mm){
			if(x.second > n / 3){
				say_answer(x.first);
				return;
			}
		} say_answer(-1);
		return;
	}
	
	for(int i=0;i<30;i++){
		int p = rand() % n + 1;
		int v = kth(p);
		int c = cnt(v);
		if(c > n / 3) { say_answer(v); return; }
	} say_answer(-1); return;
}

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

consul.cpp: In function 'void solve(int)':
consul.cpp:13:4: error: 'a' was not declared in this scope
   13 |    a[i] = kth(i);
      |    ^