Submission #155304

# Submission time Handle Problem Language Result Execution time Memory
155304 2019-09-27T13:55:24 Z jhnah917 Languages (IOI10_languages) C++14
Compilation error
0 ms 0 KB
#include "grader.h"
#include "lang.h"
#include <bits/stdc++.h>
using namespace std;

int n = 100, m = 56;

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

Compilation message

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:12:34: error: invalid types 'int[int]' for array subscript
   for(int j=0; j<n; j++) if(cnt[i][arr[j]]) cnt++;
                                  ^
lang.cpp:19:25: error: 'cnt' was not declared in this scope
  for(int i=0; i<n; i++) cnt[idx][arr[i]] = 1;
                         ^~~
lang.cpp:19:25: note: suggested alternative: 'int'
  for(int i=0; i<n; i++) cnt[idx][arr[i]] = 1;
                         ^~~
                         int
lang.cpp:18:6: warning: unused variable 'ans' [-Wunused-variable]
  int ans = language(idx);
      ^~~