Submission #434039

# Submission time Handle Problem Language Result Execution time Memory
434039 2021-06-20T14:22:45 Z KoD Languages (IOI10_languages) C++17
56 / 100
306 ms 6856 KB
#include <bits/stdc++.h>
#include "grader.h"
#include "lang.h"

#define SZ 100

bool has[56][65536];

template <class T> using Vec = std::vector<T>;

void excerpt(int *E) {
    std::map<int, int> map;
    for (int i = 0; i < SZ; ++i) {
        map[E[i]] += 1;
    }
    Vec<std::pair<int, int>> vec;
    for (const auto [x, y] : map) {
        vec.emplace_back(y, x);
    }
    std::sort(vec.rbegin(), vec.rend());
    Vec<int> cand(56);
    std::iota(cand.begin(), cand.end(), 0);
    int ret = 0;
    for (const auto [y, x] : vec) {
        Vec<int> next;
        for (const auto t : cand) {
            if (has[t][x]) {
                next.push_back(t);
            }
        }
        if (next.empty()) {
            break;
        }
        cand = std::move(next);
    }
    int max = -1;
    for (const auto t : cand) {
        int cnt = 0;
        for (const auto [x, y] : map) {
            if (has[t][x]) {
                cnt += 1;
            }
        }
        if (max < cnt) {
            max = cnt;
            ret = t;
        }
    }
    const int type = language(ret);
    for (const auto [x, y] : map) {
        has[type][x] = true;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 295 ms 6852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 306 ms 6856 KB Output is partially correct - 52.96%