Submission #575355

#TimeUsernameProblemLanguageResultExecution timeMemory
575355drekavaccLanguages (IOI10_languages)C++14
Compilation error
0 ms0 KiB
#include <lang.h>
#include <set>
#include <grader.h>
using namespace std;
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;
		}
	}
}

Compilation message (stderr)

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:9:4: error: 'map' was not declared in this scope
    9 |    map<int, int> val;
      |    ^~~
lang.cpp:4:1: note: 'std::map' is defined in header '<map>'; did you forget to '#include <map>'?
    3 | #include <grader.h>
  +++ |+#include <map>
    4 | using namespace std;
lang.cpp:9:8: error: expected primary-expression before 'int'
    9 |    map<int, int> val;
      |        ^~~
lang.cpp:10:49: error: 'val' was not declared in this scope
   10 |    for(int i=0; i<100; i++) chars.insert(a[i]), val[a[i]]++;
      |                                                 ^~~
lang.cpp:19:14: error: 'val' was not declared in this scope
   19 |    cd += abs(val[c] - slo[l][c]);
      |              ^~~
lang.cpp:19:10: error: 'abs' was not declared in this scope
   19 |    cd += abs(val[c] - slo[l][c]);
      |          ^~~
lang.cpp:29:33: warning: array subscript has type 'char' [-Wchar-subscripts]
   29 |    slo[correct] = (slo[correct][c] + val[c]) / 2;
      |                                 ^
lang.cpp:29:38: error: 'val' was not declared in this scope
   29 |    slo[correct] = (slo[correct][c] + val[c]) / 2;
      |                                      ^~~