Submission #699617

# Submission time Handle Problem Language Result Execution time Memory
699617 2023-02-17T14:00:34 Z qwerasdfzxcl Languages (IOI10_languages) C++17
99 / 100
9453 ms 39272 KB
#include "grader.h"
#include "lang.h"
#include <bits/stdc++.h>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
constexpr ll DIG = 1e5, B = 57;
unordered_set<int> st[101];
unordered_set<int> st2[101];
unordered_set<ull> st3[101];
unordered_set<ull> st4[101];

void push(int *E, int typ){

    for (int i=0;i<100;i++) st[typ].insert(E[i]);
    for (int i=0;i<99;i++) st2[typ].insert(E[i]<<16 | E[i+1]);
    for (int i=0;i<98;i++) st3[typ].insert((ull)E[i]<<32 | (ull)E[i+1]<<16 | E[i+2]);
    for (int i=0;i<97;i++) st4[typ].insert((ull)E[i]<<48 | (ull)E[i+1]<<32 | (ull)E[i+2]<<16 | E[i+3]);
}

int calc(int *E, int typ){
    int ret = 0;
    for (int i=0;i<100;i++){
        if (st[typ].find(E[i])==st[typ].end()) ret++;
    }
    for (int i=0;i<99;i++){
        if (st2[typ].find(E[i]<<16 | E[i+1])==st2[typ].end()) ret++;
    }
    for (int i=0;i<98;i++){
        if (st3[typ].find((ull)E[i]<<32 | (ull)E[i+1]<<16 | E[i+2])==st3[typ].end()) ret++;
    }

    for (int i=0;i<97;i++){
        if (st4[typ].find((ull)E[i]<<48 | (ull)E[i+1]<<32 | (ull)E[i+2]<<16 | E[i+3])==st4[typ].end()) ret++;
    }
    return ret;
}

void excerpt(int *E){
    int mn = 1e9, idx = -1;
    for (int i=0;i<56;i++){
        int score = calc(E, i);
        if (score < mn){
            mn = score;
            idx = i;
        }
    }

    push(E, language(idx));
}
# Verdict Execution time Memory Grader output
1 Correct 9257 ms 39196 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 9453 ms 39272 KB Output is partially correct - 90.47%