Submission #1011356

# Submission time Handle Problem Language Result Execution time Memory
1011356 2024-06-30T12:20:48 Z Double_Slash Languages (IOI10_languages) C++17
79 / 100
4030 ms 1104 KB
#include "lang.h"
#include "grader.h"
#include <bits/stdc++.h>
 
using namespace std;
#define debug(x) [&] { auto _x = x; cerr << __LINE__ << ": " << #x << " = " << _x << endl; return _x; }()
 
double magic(double x) {
	return pow(abs(x), 1.2);
}
 
template <typename T>
struct Data : map<T, int> {
	int tot = 0;

	double operator&(const Data<T> &o) const {
		double ret = 0;
		for (auto [k, v]: *this) {
			ret += magic((double) v / tot - (o.count(k) ? (double) o.at(k) / o.tot : 0));
		}
		for (auto [k, v]: o) {
			if (not this->count(k)) ret += magic((double) v / o.tot);
		}
		return ret;
	}
 
	void operator+=(const Data<T> &o) {
		for (auto &[k, v]: o) {
			(*this)[k] += v;
		}
		tot += o.tot;
	}};
 
struct Profile {
	Data<int> single;
 
	Profile() {}
 
	Profile(int *arr) {
		for (int i = 0; i < 100; ++i) {
			single[arr[i]]++;
		}
		single.tot = 100;
	}
 
	double operator&(const Profile &o) const {
		return single & o.single;
	}
 
	void operator+=(const Profile &o) {
		single += o.single;
	}
} profile[56];
 
void excerpt(int *E) {
	Profile p(E);
	pair<double, int> mn{1e18, 0};
	for (int i = 0; i < 56; ++i) {
		mn = min(mn, {p & profile[i], i});
	}
	int ans = language(mn.second);
	profile[ans] += p;
}
# Verdict Execution time Memory Grader output
1 Correct 4030 ms 1092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 3860 ms 1104 KB Output is partially correct - 72.94%