답안 #699610

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
699610 2023-02-17T13:33:37 Z qwerasdfzxcl Languages (IOI10_languages) C++17
95 / 100
5219 ms 18240 KB
#include "grader.h"
#include "lang.h"
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
constexpr ll DIG = 1e5;
unordered_set<int> st[101];
unordered_set<ll> st2[101];
unordered_set<ll> st3[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((ll)E[i]*DIG + E[i+1]);
    for (int i=0;i<98;i++) st3[typ].insert((ll)E[i]*DIG*DIG + E[i+1]*DIG + E[i+2]);
}

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((ll)E[i]*DIG + E[i+1])==st2[typ].end()) ret++;
    for (int i=0;i<98;i++) if (st3[typ].find((ll)E[i]*DIG*DIG + E[i+1]*DIG + E[i+2])==st3[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));
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5091 ms 18240 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 5219 ms 18076 KB Output is partially correct - 87.40%