#include "grader.h"
#include "lang.h"
#include <bits/stdc++.h>
using namespace std;
// macros
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> lll;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<lll> vlll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define FOR(a,b) for(auto& a : b)
#define all(a) a.begin(), a.end()
#define INF 1e9
#define EPS 1e-9
#define pb push_back
#define popb pop_back
#define fi first
#define se second
#define sz size()
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MX = 659;
const int MX2 = 53;
double mp[56][MX][MX];
double mp3[56][MX2][MX2][MX2];
double cnt[56];
set<int> possible;
int b[100];
int c[100];
inline int h(int x) {
return x%MX;
}
inline int g(int x) {
return x%MX2;
}
void excerpt(int *E) {
static bool first = true;
if(first) {
RE(i,56) RE(j,MX) RE(k,MX) mp[i][j][k] = 0.0;
RE(i,56) RE(j,MX2) RE(k,MX2) RE(l,MX2) mp3[i][j][k][l] = 0.0;
RE(i,56) cnt[i] = 0.0;
first = false;
}
RE(i,100) b[i] = h(E[i]);
RE(i,100) c[i] = g(E[i]);
int asking = 0; double best = 0.0;
FOR(j,possible) {
double cur = 0.0;
RE(i,99) {
double val = mp[j][b[i]][b[i+1]] / cnt[j];
if(val > 0.0) cur += pow(val,0.2);
}
RE(i,98) {
double val = mp3[j][c[i]][c[i+1]][c[i+2]] / cnt[j];
if(val > 0.0) cur += pow(val,0.7);
}
if(cur > best) best = cur, asking = j;
}
int res = language(asking);
possible.insert(res);
RE(i,99) mp[res][b[i]][b[i+1]] += 1.0;
RE(i,98) mp3[res][c[i]][c[i+1]][c[i+2]] += 1.0;
cnt[res] += 1.0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7044 ms |
255912 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7116 ms |
255916 KB |
Output is correct - 91.10% |