Submission #363449

# Submission time Handle Problem Language Result Execution time Memory
363449 2021-02-06T03:46:07 Z cig32 Languages (IOI10_languages) C++17
75 / 100
408 ms 5996 KB
#include "bits/stdc++.h"
#include "lang.h"
#include "grader.h"
using namespace std;
int word[65536][56];
int totcnt[65536];
vector<int>answers;
int chars[56];
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=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(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]+=1;//1.0/chars[k];
            }
        }
    }
    for(int j=0;j<56;j++){
        m=max(m,s[j]);
    }
    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);
            if(ans!=j){
                diff+=s[j]-s[ans];
            }
            break;
        }
    }
    for(int j=0;j<100;j++){
        word[a[j]][ans]++;
        if(word[a[j]][ans]==1)chars[ans]++;
    }
}
/*
Target: 93% accuracy
Current: 66% accuracy
 
Language 5 sampleS:
1043 1088 1086 1073 1085 1080 1094 1099 32 1080 1084 1087 1077 1088 1072 1090 1086 1088 1086 1074 32 1076 1080 1085 1072 1089 1090 1080 1080 32 1052 1080 1085 32 1080 32 1062 1080 1085 32 8212 32 1087 1072 1084 1103 1090 1085 1080 1082 32 1042 1089 1077 1084 1080 1088 1085 1086 1075 1086 32 1085 1072 1089 1083 1077 1076 1080 1103 32 1070 1053 1045 1057 1050 1054 32 44 32 1089 1086 1089 1090 1086 1103 1097 1080 1081 32 1080 1079 32 1085 1077 1089 1082 1086 1083 1100
 
1050 1086 1089 1090 1088 1086 1084 1089 1082 1086 1077 32 1085 1072 1084 1077 1089 1090 1085 1080 1095 1077 1089 1090 1074 1086 32 38 35 49 54 48 59 8212 32 1072 1076 1084 1080 1085 1080 1089 1090 1088 1072 1090 1080 1074 1085 1086 45 1090 1077 1088 1088 1080 1090 1086 1088 1080 1072 1083 1100 1085 1072 1103 32 1077 1076 1080 1085 1080 1094 1072 32 1056 1086 1089 1089 1080 1081 1089 1082 1086 1081 32 1080 1084 1087 1077 1088 1080 1080 32 44 32 1089 1091 1097 1077
 
42 32 1076 1072 1085 1085 1086 1081 32 1089 1090 1072 1090 1100 1077 32 1087 1088 1080 1074 1086 1076 1103 1090 1089 1103 32 1089 1074 1077 1076 1077 1085 1080 1103 32 1086 32 1084 1091 1079 1099 1082 1072 1083 1100 1085 1099 1093 32 1072 1083 1100 1073 1086 1084 1072 1093 32 40 32 1089 1072 1091 1085 1076 1090 1088 1077 1082 1072 1093 32 1080 32 1089 1080 1085 1075 1083 1072 1093 32 41 44 32 1080 1084 1077 1102 1097 1080 1093 32 1086 1090 1085 1086 1096 1077 
 
Meanwhile, langauge 35:
1041 1077 1085 1075 1072 1083 1099 1085 32 1073 1072 1088 32 40 32 80 97 110 116 104 101 114 97 32 116 105 103 114 105 115 32 116 105 103 114 105 115 32 1073 1091 1102 1091 32 80 97 110 116 104 101 114 97 32 116 105 103 114 105 115 32 98 101 110 103 97 108 101 110 115 105 115 32 41 32 1069 1085 1101 1090 1093 1101 1075 32 44 32 1041 1072 1085 1075 1083 1072 1076 1077 1096 1090 32 1075 1086 1083 1076 1091 1091
*/

Compilation message

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:58:40: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   58 |         if(word[a[j]][ans]==1)chars[ans]++;
      |                               ~~~~~~~~~^
# Verdict Execution time Memory Grader output
1 Correct 335 ms 5996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 408 ms 5996 KB Output is partially correct - 69.47%