#include <bits/stdc++.h>
#include "grader.h"
#include "lang.h"
using namespace std;
typedef double ld;
const int N = 100;
const int LANG = 64;
const int MAX_CHAR = 65536;
int *e;
int cnt[LANG];
map<pair<int, int>, int> pair_cnt[LANG];
int char_cnt[LANG][MAX_CHAR];
void excerpt(int *_e){
e = _e;
map<int, int> mp;
for(int i = 0; i < N; ++i)
mp[e[i]]++;
ld best_sim = 0.0;
int best_guess = 0;
for(int guess = 0; guess < 56; ++guess){
if(!cnt[guess]) continue;
ld curr_sim = 0;
//for(int i = 0; i < N - 1; ++i){
// if(!pair_cnt[guess].count({e[i], e[i + 1]})) continue;
// curr_sim += (ld)pair_cnt[guess][{e[i], e[i + 1]}] / (ld)cnt[guess];
//}
for(auto [x, cnt_x]: mp)
curr_sim += abs((ld)char_cnt[guess][x] / (ld)cnt[guess] - (ld)cnt_x);
if(curr_sim > best_sim){
best_sim = curr_sim;
best_guess = guess;
}
}
int ans = language(best_guess);
++cnt[ans];
// for(int i = 0; i < N - 1; ++i)
// pair_cnt[ans][{e[i], e[i + 1]}]++;
for(int i = 0; i < N; ++i)
char_cnt[ans][e[i]]++;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
329 ms |
3916 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
334 ms |
3904 KB |
Output isn't correct - 0.08% |