| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 660237 | QwertyPi | Languages (IOI10_languages) | C++14 | 0 ms | 0 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 10000, M = 100, L = 56;
int cnt[56][65536], s[65536], tr[56];
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> line(){
	vector<int> ret;
	for(int i = 0; i < M; i++){
		int v; cin >> v;
		ret.push_back(v);
	}
	return ret;
}
long double sc(vector<int>& l, int lang){
	long double ret = 0;
	for(auto i : l){
		if(s[i] == 0) continue;
		if(cnt[lang][i] == s[i]) ret += 1;
		ret += (long double) cnt[lang][i] / s[i] / tr[lang];
	}
	return ret;
}
int main() {
	int correct = 0;
	for(int i = 0; i < N; i++){
		vector<int> l = line();
		vector<int> ord; for(int i = 0; i < L; i++) ord.push_back(i);
		for(int i = 0; i < L; i++) swap(ord[i], ord[rng() % (i + 1)]);
		int ans = -1;
		long double val = -1;
		for(int i = 0; i < L; i++){
			long double score = sc(l, ord[i]);
			if(score > val){
				val = score;
				ans = ord[i];
			}
		}
#ifdef ONLINE_JUDGE
		cout << ans << endl;
#endif
		int rans; cin >> rans;
		if(ans == rans) correct++;
		tr[rans]++;
		for(auto i : l){
			cnt[rans][i]++;
			s[i]++;
		}
	}
#ifndef ONLINE_JUDGE
		printf("Percentage: %2.2f%%", (float) correct / N * 100);
#endif
	return 0;
}
