Submission #12886

# Submission time Handle Problem Language Result Execution time Memory
12886 2015-01-18T12:56:48 Z gs14004 Languages (IOI10_languages) C++
31 / 100
1463 ms 39804 KB
#include <map>
#include <algorithm>
#include <vector>
#include "lang.h"
#include "grader.h"
using namespace std;

map<long long,int> mp5, mp4;
vector<long long> v,u;
const int l = 5;
const int p = 69997;

void excerpt(int *E){
    int cnt[105] = {};
    v.clear();
    for (int i=0; i<96; i++) {
        long long px = 0, py = 0;
        for (int j=0; j<l; j++) {
            if(j != l-1) py = p * py + E[i+j];
            px = p * px + E[i+j];
        }
        map<long long,int> ::iterator it = mp5.lower_bound(px);
        if(it != mp5.end()) cnt[(*it).second]++;
        it = mp4.lower_bound(py);
        if(it != mp4.end()) cnt[(*it).second]++;
        v.push_back(px);
        u.push_back(py);
    }
    int mv = (int)(max_element(cnt,cnt+56) - cnt);
    int t = language(mv);
    for (int i=0; i<v.size(); i++) {
        mp5[v[i]] = t;
        mp4[u[i]] = t;
    }
}

Compilation message

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:31:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0; i<v.size(); i++) {
                   ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1463 ms 39800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 1460 ms 39804 KB Output is partially correct - 31.21%