Submission #315059

# Submission time Handle Problem Language Result Execution time Memory
315059 2020-10-22T01:48:39 Z Seanliu CONSUL (info1cup19_consul) C++14
100 / 100
29 ms 256 KB
#include "grader.h"
#define min(a,b) ((a<b)?(a):(b))
int seed = 101;

inline int rnd(){
	return seed = (seed * 3 + 1) % 0xdefaced;
}


void solve(int N){
	for(int i = 0; i < min(30, (N / 2)); i++){
		int r = rnd() % N + 1;
		int v = kth(r);
		int c = cnt(v);
		//cout << "loc = " << r << ", val = " << v << ", cnt = " << c << endl;
		if(c > (N / 3)){
			say_answer(v);
			return;
		}
	}
	say_answer(-1);
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 256 KB Output is correct
2 Correct 7 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 256 KB Output is correct
2 Correct 24 ms 256 KB Output is correct
3 Correct 7 ms 256 KB Output is correct
4 Correct 7 ms 256 KB Output is correct
5 Correct 20 ms 256 KB Output is correct
6 Correct 24 ms 256 KB Output is correct
7 Correct 23 ms 256 KB Output is correct
8 Correct 18 ms 256 KB Output is correct
9 Correct 25 ms 256 KB Output is correct
10 Correct 29 ms 256 KB Output is correct
11 Correct 24 ms 256 KB Output is correct
12 Correct 22 ms 256 KB Output is correct
13 Correct 26 ms 256 KB Output is correct
14 Correct 25 ms 256 KB Output is correct