#if 01
#include <stdlib.h>
#include <stdio.h>
#include "grader.h"
#include "lang.h"
#define SZ 100
#define M (100003)
#define LANG (56)
#define P (65537)
typedef long long ll;
const int roll = 3;
ll save[SZ + 1];
int cnt[LANG][P];
int hcnt[LANG][M];
int vote[LANG];
ll hash(int *E){
ll hash_value = 0;
ll p_pow = 1;
for (int i = 0; i < roll; i++){
hash_value = (hash_value + E[i] * p_pow) % M;
p_pow = (p_pow*P) % M;
}
return hash_value;
}
void excerpt(int *E) {
for (int i = 0; i < SZ - roll + 1; i++){
save[i] = hash(E + i);
}
for (int i = 0; i < LANG; i++){
vote[i] = 0;
for (int j = 0; j < SZ; j++){
if (cnt[i][E[j]])vote[i]++;
if (i < SZ - roll + 1)
if (hcnt[i][save[j]])vote[i]++;
}
}
int guess = 0, max = 0;
for (int i = 0; i < LANG; i++){
if (max < vote[i])guess = i, max = vote[i];
}
int ans = language(guess);
for (int i = 0; i < SZ; i++){
cnt[ans][i]++;
if (i<SZ - roll + 1) hcnt[ans][save[i]]++;
}
}
#endif
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1508 ms |
22616 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1281 ms |
22524 KB |
Output is partially correct - 86.50% |