답안 #204868

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
204868 2020-02-27T11:47:58 Z MetB Languages (IOI10_languages) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

int a[50][100000], b[100000];

void excerpt (int* E) {
    int cnt[100000];
    memset (cnt, 0, sizeof (cnt));
    set <int> s;
    
    for (int i = 0; i < 100; i++) {
        cnt[E[i]]++;
        s.insert (E[i]);
    }
    
    double mx = 0;
    int x = 0;
    
    for (int i = 0; i < 50; i++) {
        double  points = 0;
        for (int j  : s) {
            if (b[j]) points += cnt[j] * (a[i][j] / b[j]);
        }
        
        if (points > mx) {
            mx = points;
            x = i;
        }
    }
    
    language (x);
    
    for (int i = 0; i < 100; i++) {
        b[E[i]]++;
        a[x][E][i]++;
    }
}

Compilation message

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:8:5: error: 'set' was not declared in this scope
     set <int> s;
     ^~~
lang.cpp:8:5: note: suggested alternative:
In file included from /usr/include/c++/7/set:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:87,
                 from lang.cpp:1:
/usr/include/c++/7/bits/stl_set.h:93:11: note:   'std::set'
     class set
           ^~~
lang.cpp:8:10: error: expected primary-expression before 'int'
     set <int> s;
          ^~~
lang.cpp:12:9: error: 's' was not declared in this scope
         s.insert (E[i]);
         ^
lang.cpp:20:23: error: 's' was not declared in this scope
         for (int j  : s) {
                       ^
lang.cpp:30:5: error: 'language' was not declared in this scope
     language (x);
     ^~~~~~~~
lang.cpp:34:15: error: invalid types 'int [100000][int*]' for array subscript
         a[x][E][i]++;
               ^