답안 #44969

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
44969 2018-04-10T09:00:24 Z junodeveloper Languages (IOI10_languages) C++14
컴파일 오류
0 ms 0 KB
#include "lang.h"
#include "grader.h"
#include <map>
typedef unsigned long long ll;
map<ll, int> mp[56];
int excerpt(int* a) {
	int cnt[56] = {0};
	for(int i=0; i<96; i++) {
		ll val = 0;
		for(int j=0; j<4; j++)
			val = val * 65535 + a[i] - 1;
		int mx = 0, idx = 0;
		for(int j=0; j<56; j++)
			if(mx < mp[j][val])
			mx = mp[j][val], idx = j;
		cnt[idx]++;
	}
	int ret = max_element(cnt, cnt+56) - cnt;
	int ans = language(ret);
	for(int i=0; i<96; i++) {
		ll val = 0;
		for(int j=0; j<4; j++)
			val = val * 65535 + a[i] - 1;
		mp[ans][val]++;
	}
}

Compilation message

lang.cpp:5:1: error: 'map' does not name a type
 map<ll, int> mp[56];
 ^~~
lang.cpp: In function 'int excerpt(int*)':
lang.cpp:6:5: error: ambiguating new declaration of 'int excerpt(int*)'
 int excerpt(int* a) {
     ^~~~~~~
In file included from lang.cpp:1:0:
lang.h:1:6: note: old declaration 'void excerpt(int*)'
 void excerpt(int *E);
      ^~~~~~~
lang.cpp:14:12: error: 'mp' was not declared in this scope
    if(mx < mp[j][val])
            ^~
lang.cpp:14:12: note: suggested alternative: 'mx'
    if(mx < mp[j][val])
            ^~
            mx
lang.cpp:18:12: error: 'max_element' was not declared in this scope
  int ret = max_element(cnt, cnt+56) - cnt;
            ^~~~~~~~~~~
lang.cpp:18:12: note: suggested alternative: 'max_align_t'
  int ret = max_element(cnt, cnt+56) - cnt;
            ^~~~~~~~~~~
            max_align_t
lang.cpp:24:3: error: 'mp' was not declared in this scope
   mp[ans][val]++;
   ^~
lang.cpp:26:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^