제출 #575356

#제출 시각아이디문제언어결과실행 시간메모리
575356drekavaccLanguages (IOI10_languages)C++14
컴파일 에러
0 ms0 KiB
#include <lang.h> #include <set> #include <map> #include <grader.h> int slo[60][70000]; void excerpt(int *a){ set<int> chars; map<int, int> val; for(int i=0; i<100; i++) chars.insert(a[i]), val[a[i]]++; int best = 0; int mdif = 1000000; for(int l=0; l<56; l++){ int cd = 0; for(int c : chars){ cd += abs(val[c] - slo[l][c]); } if(cd < mdif){ mdif = cd; best = l; } int correct = language(best); for(char c : chars){ slo[correct] = (slo[correct][c] + val[c]) / 2; } } }

컴파일 시 표준 에러 (stderr) 메시지

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:9:4: error: 'set' was not declared in this scope; did you mean 'std::set'?
    9 |    set<int> chars;
      |    ^~~
      |    std::set
In file included from /usr/include/c++/10/set:61,
                 from lang.cpp:2:
/usr/include/c++/10/bits/stl_set.h:94:11: note: 'std::set' declared here
   94 |     class set
      |           ^~~
lang.cpp:9:8: error: expected primary-expression before 'int'
    9 |    set<int> chars;
      |        ^~~
lang.cpp:10:4: error: 'map' was not declared in this scope; did you mean 'std::map'?
   10 |    map<int, int> val;
      |    ^~~
      |    std::map
In file included from /usr/include/c++/10/map:61,
                 from lang.cpp:3:
/usr/include/c++/10/bits/stl_map.h:100:11: note: 'std::map' declared here
  100 |     class map
      |           ^~~
lang.cpp:10:8: error: expected primary-expression before 'int'
   10 |    map<int, int> val;
      |        ^~~
lang.cpp:11:29: error: 'chars' was not declared in this scope; did you mean 'char'?
   11 |    for(int i=0; i<100; i++) chars.insert(a[i]), val[a[i]]++;
      |                             ^~~~~
      |                             char
lang.cpp:11:49: error: 'val' was not declared in this scope
   11 |    for(int i=0; i<100; i++) chars.insert(a[i]), val[a[i]]++;
      |                                                 ^~~
lang.cpp:19:15: error: 'chars' was not declared in this scope; did you mean 'char'?
   19 |   for(int c : chars){
      |               ^~~~~
      |               char
lang.cpp:20:14: error: 'val' was not declared in this scope
   20 |    cd += abs(val[c] - slo[l][c]);
      |              ^~~
lang.cpp:20:10: error: 'abs' was not declared in this scope
   20 |    cd += abs(val[c] - slo[l][c]);
      |          ^~~
lang.cpp:29:16: error: 'chars' was not declared in this scope; did you mean 'char'?
   29 |   for(char c : chars){
      |                ^~~~~
      |                char
lang.cpp:30:33: warning: array subscript has type 'char' [-Wchar-subscripts]
   30 |    slo[correct] = (slo[correct][c] + val[c]) / 2;
      |                                 ^
lang.cpp:30:38: error: 'val' was not declared in this scope
   30 |    slo[correct] = (slo[correct][c] + val[c]) / 2;
      |                                      ^~~