답안 #363373

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
363373 2021-02-05T18:23:21 Z cig32 Languages (IOI10_languages) C++17
72 / 100
282 ms 6120 KB
#include "bits/stdc++.h"
#include "lang.h"
#include "grader.h"
using namespace std;
int word[65536][56];
int totcnt[65536];
void excerpt(int *a){
    double s[56];
    double m=0;
    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(totcnt[a[j]])s[k]+=word[a[j]][k]*1.0/totcnt[a[j]];
            m=max(m,s[k]);
        }
    }
    for(int j=0;j<100;j++){
        totcnt[a[j]]++;
    }
    int ans;
    for(int j=0;j<56;j++){
        if(s[j]==m){
            ans=language(j);
            break;
        }
    }
    for(int j=0;j<100;j++){
        word[a[j]][ans]++;
    }
}

Compilation message

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:28:23: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   28 |         word[a[j]][ans]++;
      |         ~~~~~~~~~~~~~~^
# 결과 실행 시간 메모리 Grader output
1 Correct 280 ms 6120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 282 ms 6072 KB Output is partially correct - 66.52%