답안 #60886

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
60886 2018-07-24T23:38:20 Z reality Languages (IOI10_languages) C++17
64 / 100
2526 ms 3496 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 = 2;


int was[1111111];

unordered_map < U , int > T[56];

db f(auto x) {
	return x * x;
}

void excerpt(int *E) {
	int n = SZ;
	unordered_map < U , int > M;
	for (int i = 0;i < n;++i) {
		U cnt = 1;
		for (int j = i;j < n && j < i + K;++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];
		}
	}
	vector < db > sim;
	for (int i = 0;i < 56;++i) {
		db cnt = 0.0;
		for (auto it : M)
			if (T[i].count(it.fi))
				cnt += (1.0 * T[i][it.fi] - it.se);
			else
				cnt -= f(it.se);
		sim.pb(cnt);
	}
	int ans = max_element(all(sim)) - sim.begin();
	int real_ans = language(ans);
	++was[real_ans];
	for (auto it : M)
		smax(T[real_ans][it.fi],it.se);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2526 ms 3496 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 2487 ms 3484 KB Output is partially correct - 59.82%