답안 #60900

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
60900 2018-07-25T00:20:35 Z reality Languages (IOI10_languages) C++17
85 / 100
4787 ms 11248 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 = 10;

const db c = 0.9;


int was[1111111];

unordered_set < U > T[56];

ll f(auto x) {
	return (ll)(1 + (5 * x) / 1 + (5 * x) * (5 * x) * 0.5 + (4.5 * x) * (5 * x) * (5 * x) * 0.5 * 0.3333 + (4.5 * x) * (5 * x) * (5 * x) * (4 * x) * 0.5 * 0.3333 * 0.25);
}

int called = 0;

void excerpt(int *E) {
	++called;
	int n = SZ;
	unordered_map < U , int > M;
	M.reserve(SZ * 3);
	for (int i = 0;i < n;++i) {
		U cnt = 1;
		int lm = i + K;
		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 < ll > sim;
	for (int i = 0;i < 56;++i) {
		ll cnt = 0;
		for (auto it : ss)
			if (!T[i].count(it.se))
				cnt -= f(it.fi);
		sim.pb(cnt);
	}
	int ans = max_element(all(sim)) - sim.begin();
	int real_ans = language(ans);
	for (auto it : ss)
		T[real_ans].insert(it.se);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4360 ms 11208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 4787 ms 11248 KB Output is partially correct - 78.07%