답안 #363495

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
363495 2021-02-06T09:23:19 Z cig32 Languages (IOI10_languages) C++17
컴파일 오류
0 ms 0 KB
#include "bits/stdc++.h"
#define mp make_pair
#include "lang.h"
#include "grader.h"
using namespace std;
int word[65536][56];
int totcnt[65536];
vector<int>answers;
int chars[56];
int cnt=0;
int points=0;
int test_case=0;
int space_character=-1;
double diff=0;
void excerpt(int *a){
    test_case++;
    if(test_case==20){
        int mm=0;
        for(int i=0;i<65536;i++){
            mm=max(mm,totcnt[i]);
        }
        for(int i=0;i<65536;i++){
            if(mm==totcnt[i]){
                space_character=i;
                break;
            }
        }
    }
    double s[56];
    double m=-1e9;
    for(int j=0;j<56;j++)s[j]=0;
    for(int j=0;j<100;j++){
        for(int k=0;k<56;k++){
            if(a[j]==space_character)continue;
            if(totcnt[a[j]]){
                s[k]+=word[a[j]][k]*1.0/totcnt[a[j]];
            }
            if(word[a[j]][k]){
                s[k]+=0.5;//1.0/chars[k];
            }
        }
    }
    unordered_map<int,int>exists;
    for(int i=0;i<100;i++)exists[a[i]]=1;
    for(int i=0;i<56;i++){
        int cnt=0;
        for(int j=0;j<10;j++){
            if(exists[characteristic[i][j]])cnt++;
        }
        s[i]+=cnt/20.0;
    }
    for(int j=0;j<56;j++){
        m=max(m,s[j]);
    }
    if(m>mm){
        mm=m;
        //cout<<"F "<<m<<"\n";
    }
    for(int j=0;j<100;j++){
        totcnt[a[j]]++;
    }
    int ans, eh;
    for(int j=0;j<56;j++){
        if(s[j]==m){
            ans=language(j);
            eh=j;
            if(ans!=j){
                diff+=s[j]-s[ans];
                if(ans==2){
                    cout<<"ERR "<<s[j]<<" "<<s[ans]<<"\n";
                    maxdiff=max(maxdiff,s[j]-s[ans]);
                }
            }
            break;
        }
    }
    if(characteristic[ans][0]==0){
        for(int i=0;i<10;i++) characteristic[ans][i]=a[rand()%100];
    }
    anscnt[ans]++;
    corrcnt[ans]+=(ans==eh?1:0);
    for(int j=0;j<100;j++){
        word[a[j]][ans]++;
        if(word[a[j]][ans]==1)chars[ans]++;
    }
}

Compilation message

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:48:23: error: 'characteristic' was not declared in this scope
   48 |             if(exists[characteristic[i][j]])cnt++;
      |                       ^~~~~~~~~~~~~~
lang.cpp:55:10: error: 'mm' was not declared in this scope; did you mean 'm'?
   55 |     if(m>mm){
      |          ^~
      |          m
lang.cpp:71:21: error: 'maxdiff' was not declared in this scope; did you mean 'diff'?
   71 |                     maxdiff=max(maxdiff,s[j]-s[ans]);
      |                     ^~~~~~~
      |                     diff
lang.cpp:77:8: error: 'characteristic' was not declared in this scope
   77 |     if(characteristic[ans][0]==0){
      |        ^~~~~~~~~~~~~~
lang.cpp:80:5: error: 'anscnt' was not declared in this scope
   80 |     anscnt[ans]++;
      |     ^~~~~~
lang.cpp:81:5: error: 'corrcnt' was not declared in this scope
   81 |     corrcnt[ans]+=(ans==eh?1:0);
      |     ^~~~~~~