Submission #60896

# Submission time Handle Problem Language Result Execution time Memory
60896 2018-07-24T23:59:52 Z reality Languages (IOI10_languages) C++17
78 / 100
8307 ms 7252 KB
#include "grader.h"
#include "lang.h"
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}

#define U unsigned ll

#define SZ 100

const int K = 3;

const db c = 0.6;


int was[1111111];

map < U , int > T[56];

db f(auto x) {
	return pow(10,x);
}

void excerpt(int *E) {
	srand(E[0] * E[1]);
	int n = SZ;
	map < U , int > M;
	for (int i = 0;i < n;++i) {
		U cnt = 1;
		int lm = i + K;
		if (rand() % 3 == 0)
			--lm;
		for (int j = i;j < n && j < lm;++j)
			if (!('0' <= E[j] && E[j] <= '9') && !(E[j] == '-' || E[j] == '.' || E[j] == '(' || E[j] == ')' || E[j] == ' ' || E[j] == ',' || E[j] == '\"')) {
				cnt *= E[j];
				++M[cnt];
			} else {
				break;
			}
	}
	vector < pair < int , U > > ss;
	for (auto it : M)
		ss.pb(mp(it.se,it.fi));
	sort(all(ss));
	ss.resize(min((int)ss.size(),(int)(SZ * c)));
	vector < db > sim;
	for (int i = 0;i < 56;++i) {
		db cnt = 0.0;
		for (auto it : ss)
			if (T[i].count(it.se))
				cnt += (T[i][it.se] - it.fi);
			else
				cnt -= f(it.fi);
		sim.pb(cnt);
	}
	int ans = max_element(all(sim)) - sim.begin();
	int real_ans = language(ans);
	++was[real_ans];
	for (auto it : ss)
		smax(T[real_ans][it.se],it.fi);
}
# Verdict Execution time Memory Grader output
1 Correct 8307 ms 7136 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 6001 ms 7252 KB Output is partially correct - 71.77%