제출 #867632

#제출 시각아이디문제언어결과실행 시간메모리
867632MatjazLanguages (IOI10_languages)C++14
95 / 100
8473 ms30216 KiB
#include <stdlib.h> #include <stdio.h> #include <set> #include <vector> #include <algorithm> using namespace std; #include "grader.h" #include "lang.h" #define SZ 100 set<int> S[56]; int L = 56; void excerpt(int *E) { vector<int> sample; long long a = 719; long long b = 479001599; int l = 5; for (int i=0;i<100 - l + 1;i++){ int hash = 0; for (int j=0;j<l;j++){ hash = (hash * a + E[i + j]) % b; } sample.push_back(hash); } int best_score = 0; int best_guess = 0; for (int i=0;i<L;i++){ int score = 0; for (int j=0;j<sample.size();j++) score += S[i].count(sample[j]); if (best_score < score){ best_score = score; best_guess = i; } } int target = language(best_guess); S[target].insert(sample.begin(), sample.end()); }

컴파일 시 표준 에러 (stderr) 메시지

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:38:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for (int j=0;j<sample.size();j++) score += S[i].count(sample[j]);
      |                      ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...