제출 #1336427

#제출 시각아이디문제언어결과실행 시간메모리
1336427monaxiaLanguages (IOI10_languages)C++20
55 / 100
752 ms10060 KiB
#include <bits/stdc++.h>
#include <ext/random>
#include <ext/pb_ds/assoc_container.hpp>
#include "grader.h"
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
 
#define pb push_back
#define ppb pop_back
#define fr first
#define sc second
#define all(v) v.begin(), v.end()
#define vektor vector
 
using namespace std;
using namespace __gnu_pbds;
 
using ll = long long;
using ull = unsigned ll;
using ld = long double;
 
constexpr ull Mod = 100;
constexpr ull Mod2 = 1 + 7 * 17 * (1 << 23);
constexpr ull sqr = 320;
constexpr ld eps = 1e-12;
 
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll random(ll l, ll r) {if(l <= r) return uniform_int_distribution <ll> (l, r)(rng); return -1;}

unordered_map <int, int> a[56], cnt;
int cur = 0, ans = 0;

// int language(int l){
//     if(l == cur) ans ++;
//     return cur;
// }

void excerpt(int e[100]){
    int ans;
    pair <int, int> mx = {0, -1};
    // compare and guess

    for(int i = 0; i <= 55; i ++){
        int c = 0;
        for(int j = 0; j < 99; j ++){
            if(a[i][e[j]] > 0 && cnt[e[j]] <= 30) c ++;
        }

        mx = max(mx, {c, i});
    }

    ans = mx.sc;

    ans = language(ans);
    //learning

    for(int i = 0; i < 99; i ++){
        a[ans][e[i]] ++;
        if(a[ans][e[i]] == 1) cnt[e[i]] ++;
    }
}

void solve(){
    int e[10000][100];

    for(int j = 0; j <= 55; j ++){
        for(int i = 0; i < 100; i ++) e[j][i] = random(1, 65535);
    }

    for(int i = 1; i <= 10000; i ++){
        cur = random(0, 55);
        excerpt(e[cur]);
    }

    cout << ans;
}
 

 
 
// Whose eyes are those eyes?
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...