Submission #235503

# Submission time Handle Problem Language Result Execution time Memory
235503 2020-05-28T11:42:50 Z dolphingarlic Languages (IOI10_languages) C++14
0 / 100
4473 ms 262144 KB
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")
#pragma GCC target("sse4,avx2,fma,avx")
#define FOR(i, x, y) for (int i = x; i < y; i++)
typedef long long ll;
using namespace std;

#include "grader.h"
#include "lang.h"

const int SZ = 100, LANGS = 56;

ll si[SZ], bi[SZ], tr[SZ], qu[SZ];
int cnt[LANGS];
unordered_map<int, unordered_map<ll, int>> freq;

inline double hyperb(int x) { return x / (x + 1.0); }

void excerpt(int *E) {
    FOR(i, 0, SZ - 3) {
        qu[i] = 0;
        FOR(j, 0, 4) qu[i] = (qu[i] << 16) + E[i + j];
        tr[i] = qu[i] >> 16;
        bi[i] = tr[i] >> 16;
        si[i] = bi[i] >> 16;
    }

    int best = 0;
    double best_sim = 0;
    FOR(i, 0, LANGS) {
        double sim = 0;
        FOR(j, 0, SZ - 3) {
            sim += hyperb(freq[i][qu[j]]) * 130;
            sim += hyperb(freq[i][tr[j]]) * 64;
            sim += hyperb(freq[i][bi[j]]) * 17;
            sim += hyperb(freq[i][si[j]]) * 1;
        }
        sim /= log(cnt[i] + 1);

        if (sim > best_sim) best = i, best_sim = sim;
    }

    int ans = language(best);
    cnt[ans]++;
    FOR(i, 0, SZ - 3) {
        freq[ans][qu[i]]++;
        freq[ans][tr[i]]++;
        freq[ans][bi[i]]++;
        freq[ans][si[i]]++;
    }
}
# Verdict Execution time Memory Grader output
1 Runtime error 4428 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 4473 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)