Submission #390751

# Submission time Handle Problem Language Result Execution time Memory
390751 2021-04-16T21:04:48 Z Sorting Languages (IOI10_languages) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"
#include "lang.h"

using namespace std;

typedef double ld;
const int N = 100;
const int LANG = 64;
const int MAX_CHAR = 65536;

int *e;
int cnt[LANG];
map<pair<int, int>, int> pair_cnt[LANG]; 

void excerpt(int *_e){
    e = _e;

    ld best_sim = 0.0;
    int best_guess = 0;
    for(int guess = 0; guess < 56; ++guess){
        ld curr_sim = 0;
        for(int i = 0; i < N - 1; ++i){
            if(!pair_cnt[guess].count({e[i], e[i + 1]})) continue;
            curr_sim += (ld)pair_cnt[guess][{e[i], e[i + 1]}] / (ld)cnt[guess];
        }
        if(curr_sim > best_sim){
            best_sim = curr_sim
            best_guess = guess;
        }
    }

    int ans = language(guess);
    ++cnt[ans];
    for(int i = 0; i < N - 1; ++i)
        pair_cnt[ans][{e[i], e[i + 1]}]++;
}

Compilation message

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:28:32: error: expected ';' before 'best_guess'
   28 |             best_sim = curr_sim
      |                                ^
      |                                ;
   29 |             best_guess = guess;
      |             ~~~~~~~~~~          
lang.cpp:33:24: error: 'guess' was not declared in this scope
   33 |     int ans = language(guess);
      |                        ^~~~~
lang.cpp:20:9: warning: unused variable 'best_guess' [-Wunused-variable]
   20 |     int best_guess = 0;
      |         ^~~~~~~~~~