제출 #1336426

#제출 시각아이디문제언어결과실행 시간메모리
1336426monaxiaLanguages (IOI10_languages)C++20
컴파일 에러
0 ms0 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;
}
 
main(){
    ios_base::sync_with_stdio(false);   
    cin.tie(NULL); 
 
    if(fopen("placeholder.inp", "r")){
        freopen("placeholder.inp", "r", stdin);
        freopen("placeholder.out", "w", stdout);
    }
 
    ll t = 1;
 
    // cin >> t;
 
    while(t --){
        solve();
        cout << "\n";
    }
 
    cerr << "Code time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}
 
 
 
// Whose eyes are those eyes?

컴파일 시 표준 에러 (stderr) 메시지

lang.cpp:78:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   78 | main(){
      | ^~~~
lang.cpp: In function 'int main()':
lang.cpp:83:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   83 |         freopen("placeholder.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lang.cpp:84:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   84 |         freopen("placeholder.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccdGjDcz.o: in function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'; /tmp/ccJn3q93.o:lang.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status