Submission #170461

# Submission time Handle Problem Language Result Execution time Memory
170461 2019-12-25T11:23:31 Z Mounir CONSUL (info1cup19_consul) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

void solve(int N){
	srand(42);
	
	int tot = 0;
	set<int> faits;
	
	while (tot <= 2*N/3){
		int cur = kth((int)rand()%N);
		if (faits.count(cur) == 0){
		//	cout << cur << endl;
			int nCur = cnt(cur);
			if (nCur >= double(N)/3){
				say_answer(cur);
				return;
			}
			tot += nCur;
			faits.insert(cur);
		}
	}
	say_answer(-1);
}

Compilation message

consul.cpp: In function 'void solve(int)':
consul.cpp:11:13: error: 'kth' was not declared in this scope
   int cur = kth((int)rand()%N);
             ^~~
consul.cpp:14:15: error: 'cnt' was not declared in this scope
    int nCur = cnt(cur);
               ^~~
consul.cpp:14:15: note: suggested alternative: 'int'
    int nCur = cnt(cur);
               ^~~
               int
consul.cpp:16:5: error: 'say_answer' was not declared in this scope
     say_answer(cur);
     ^~~~~~~~~~
consul.cpp:16:5: note: suggested alternative: 'sa_handler'
     say_answer(cur);
     ^~~~~~~~~~
     sa_handler
consul.cpp:23:2: error: 'say_answer' was not declared in this scope
  say_answer(-1);
  ^~~~~~~~~~
consul.cpp:23:2: note: suggested alternative: 'sa_handler'
  say_answer(-1);
  ^~~~~~~~~~
  sa_handler