Submission #204884

# Submission time Handle Problem Language Result Execution time Memory
204884 2020-02-27T12:16:24 Z MetB Languages (IOI10_languages) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"
#include "lang.h"

int a[3][56][100000], b[3][100000];
int cnt[3][100000];
const int MOD = 100000;

void excerpt (int* E) {
    memset (cnt, 0, sizeof (cnt));
    std::set <int> s, ps;
    
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < min (2, n - i); j++) {
            int val = 0;
            for (int k = 0; k <= j; k++)
                val = val * E[i+k] % MOD;
            cnt[j][val]++;
            s[j].insert (val);
        }
    }
    
    double mx = 0;
    int x = 0;
    
    for (int i = 0; i < 56; i++) {
        double points = 0;
        
        for (int k = 0; k < 2; k++) {
            for (int j : s[k]) {
                if (b[k][j]) points += cnt[k][j] * ((double) a[k][i][j] / b[k][j]) * (k + 1);
            }
        }
        
        if (mx < points) {
            mx = points;
            x = i;
        }
    }
    
    x = language (x);
    
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < min (2, n - i); j++) {
            int val = 0;
            for (int k = 0; k <= j; k++)
                val = val * E[i+k] % MOD;
            a[j][x][val]++;
            b[j][val]++;
        }
    }
}

Compilation message

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:14:37: error: 'n' was not declared in this scope
         for (int j = 0; j < min (2, n - i); j++) {
                                     ^
lang.cpp:14:29: error: 'min' was not declared in this scope
         for (int j = 0; j < min (2, n - i); j++) {
                             ^~~
lang.cpp:14:29: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from lang.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   'std::min'
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
lang.cpp:19:14: error: no match for 'operator[]' (operand types are 'std::set<int>' and 'int')
             s[j].insert (val);
              ^
lang.cpp:30:27: error: no match for 'operator[]' (operand types are 'std::set<int>' and 'int')
             for (int j : s[k]) {
                           ^
lang.cpp:44:37: error: 'n' was not declared in this scope
         for (int j = 0; j < min (2, n - i); j++) {
                                     ^
lang.cpp:44:29: error: 'min' was not declared in this scope
         for (int j = 0; j < min (2, n - i); j++) {
                             ^~~
lang.cpp:44:29: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from lang.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   'std::min'
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~