답안 #61240

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
61240 2018-07-25T12:23:07 Z reality Languages (IOI10_languages) C++17
98 / 100
6155 ms 79380 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 = 8;
 
const db c = 0.3;

unordered_map < U , U > T;
 
vector < db > C;
 
ll f(auto x) {
	return C[0] + x * C[1] + x * x * C[2];
}
 
int called = 0;
 
void excerpt(int *E) {
	++called;
	if (called == 1) {
		srand(time(0));
		T.reserve((int)(SZ * c * 1e4));
		C.pb(rand() % 32);
		C.pb(rand() % 16);
		C.pb(rand() % 4);
	}
	int n = SZ;
	vector < U > M;
	for (int i = 0;i < n;++i) {
		U cnt = 1;
		int lm = i + K;
		if (rand() % 4 != 0)
			--lm;
		for (int j = i;j < n && j < lm;++j)
			if (1) {//!('0' <= E[j] && E[j] <= '9') && !(E[j] == '-' || E[j] == '.' || E[j] == '(' || E[j] == ')' || E[j] == ' ' || E[j] == ',' || E[j] == '\"')) {
				cnt *= E[j];
				M.pb(cnt);
			} else {
				break;
			}
	}
	vector < pair < int , U > > ss;
	if (ss.size() > SZ * c)
		ss.resize((int)(SZ * c));
	sort(all(M));
	int szz = M.size();
	for (int i = 0,j;i < szz;i = j) {
		j = i;
		while (j < szz && M[i] == M[j])
			++j;
		ss.pb(mp(j - i,M[i]));
	}
	sort(all(ss));
	vector < ll > sim(56,0);
	for (auto it : ss) {
		ll mask = T[it.se];
		for (int i = 0;i < 56;++i)
			if (!((mask >> i) & 1))
				sim[i] += f(it.fi);
	}
	int ans = min_element(all(sim)) - sim.begin();
	int real_ans = language(ans);
	for (auto it : ss)
		T[it.se] |= 1ll << real_ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6155 ms 79380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 6095 ms 79316 KB Output is partially correct - 89.66%