답안 #155310

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
155310 2019-09-27T14:10:33 Z jhnah917 Languages (IOI10_languages) C++14
컴파일 오류
0 ms 0 KB
#include "grader.h"
#include "lang.h"
#include <bits/stdc++.h>
using namespace std;

const int n = 100, m = 56;

map<ll, int> cnt[56];
map<ll, int> cnt2[56];
map<ll, int> cnt3[56];
map<ll, int> cnt4[56];

ll f(ll a, ll b){
	return (a << 16) | b;
}

ll f(ll a, ll b, ll c){
	return (a << 32) | (b << 16) | c;
}

ll f(ll a, ll b, ll c, ll d){
	return (a << 48) | (b << 32) | (c << 16) | d;
}

void excerpt(int *arr){
	int mx = 0, idx = 0;
	for(int i=0; i<m; i++){
		int now = 0;
		for(int j=0; j<n; j++){
			now += cnt[i][arr[j]];
			if(j == n-1) break;
			now += cnt[i][f(arr[j], arr[j+1])];
			if(j == n-2) break;
			now += cnt[i][f(arr[j], arr[j+1], arr[j+2])];
			if(j == n-3) break;
			now += cnt[i][f(arr[j], arr[j+1], arr[j+2], arr[j+3])];
		}
		if(now > mx){
			mx = now; idx = i;
		}
	}
	
	int ans = language(idx);
	for(int i=0; i<n; i++){
		cnt[ans][arr[i]] = 1;
		if(i == n-1) break;
		cnt[ans][f(arr[i], arr[i+1])] = 1;
		if(i == n-2) break;
		cnt[ans][f(arr[i], arr[i+1], arr[i+2])] = 1;
		if(i == n-3) break;
		cnt[ans][f(arr[i], arr[i+1], arr[i+2], arr[i+3])] = 1;
	}
}

Compilation message

lang.cpp:8:5: error: 'll' was not declared in this scope
 map<ll, int> cnt[56];
     ^~
lang.cpp:8:12: error: template argument 1 is invalid
 map<ll, int> cnt[56];
            ^
lang.cpp:8:12: error: template argument 3 is invalid
lang.cpp:8:12: error: template argument 4 is invalid
lang.cpp:9:5: error: 'll' was not declared in this scope
 map<ll, int> cnt2[56];
     ^~
lang.cpp:9:12: error: template argument 1 is invalid
 map<ll, int> cnt2[56];
            ^
lang.cpp:9:12: error: template argument 3 is invalid
lang.cpp:9:12: error: template argument 4 is invalid
lang.cpp:10:5: error: 'll' was not declared in this scope
 map<ll, int> cnt3[56];
     ^~
lang.cpp:10:12: error: template argument 1 is invalid
 map<ll, int> cnt3[56];
            ^
lang.cpp:10:12: error: template argument 3 is invalid
lang.cpp:10:12: error: template argument 4 is invalid
lang.cpp:11:5: error: 'll' was not declared in this scope
 map<ll, int> cnt4[56];
     ^~
lang.cpp:11:12: error: template argument 1 is invalid
 map<ll, int> cnt4[56];
            ^
lang.cpp:11:12: error: template argument 3 is invalid
lang.cpp:11:12: error: template argument 4 is invalid
lang.cpp:13:1: error: 'll' does not name a type
 ll f(ll a, ll b){
 ^~
lang.cpp:17:1: error: 'll' does not name a type
 ll f(ll a, ll b, ll c){
 ^~
lang.cpp:21:1: error: 'll' does not name a type
 ll f(ll a, ll b, ll c, ll d){
 ^~
lang.cpp: In function 'void excerpt(int*)':
lang.cpp:30:24: error: invalid types 'int[int]' for array subscript
    now += cnt[i][arr[j]];
                        ^
lang.cpp:32:18: error: 'f' was not declared in this scope
    now += cnt[i][f(arr[j], arr[j+1])];
                  ^
lang.cpp:45:18: error: invalid types 'int[int]' for array subscript
   cnt[ans][arr[i]] = 1;
                  ^
lang.cpp:47:12: error: 'f' was not declared in this scope
   cnt[ans][f(arr[i], arr[i+1])] = 1;
            ^