답안 #65840

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
65840 2018-08-09T02:03:24 Z jaehun630 Languages (IOI10_languages) C++14
0 / 100
296 ms 2112 KB
#include <stdlib.h>
#include <stdio.h>
#include <vector>

#include "grader.h"
#include "lang.h"

#define SZ 100
int prev[1100000];
std::vector<std::pair<int, int>> v[65536];

void excerpt(int *E) {	
	int lang[56];
	for (int i = 0; i < 56; i++) lang[i] = 0;

	for (int i = 0; i < 100; i++)
		if (v[E[i]].size() > 0)
			for (int j = 0; j < v[E[i]].size(); j++)
				lang[v[E[i]].at(j).first] += v[E[i]].at(j).second;

	int idx = 0, cnt = 0; 
	for (int i = 0; i < 56; i++)
		if (cnt < lang[i])
			cnt = lang[i], idx = i;

	int ans = language(idx);

	for (int i = 0; i < 100; i++){
		int inserted = 0;
		if (v[E[i]].size() > 0) 
			for (std::vector<std::pair<int, int>>::iterator iter = v[E[i]].begin(); iter != v[E[i]].end(); ++iter)
				if ((*iter).first == ans) {
					(*iter).second++;
					inserted =1;
					break;
				}
		
		if(!inserted)
			v[E[i]].push_back(std::make_pair(ans, 1));
	}
}

Compilation message

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:18:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int j = 0; j < v[E[i]].size(); j++)
                    ~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 296 ms 2016 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 295 ms 2112 KB Output isn't correct - 26.38%