Submission #867623

# Submission time Handle Problem Language Result Execution time Memory
867623 2023-10-29T02:34:58 Z Matjaz Languages (IOI10_languages) C++14
Compilation error
0 ms 0 KB
#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) {
    
    set<int> sample;
    long long a = 719;
    long long b = 479001599;
    int l = 2;
    for (int i=0;i<100 - l + 1;i++){
         hash = 0;
        for (int j=0;j<l;j++){
            hash = (hash * a + E[i + j]) % b;
        }
        sample.insert(hash);
    }
    
    
    int best_score = 0;
    int best_guess = 0;
    
    for (int i=0;i<L;i++){
        
        set<int> intersect;
        set_intersection(sample.begin(), sample.end(), S[i].begin(), S[i].end(),
                         std::inserter(intersect, intersect.begin()));
        
        int score = intersect.size();
        
        if (best_score < score){
            best_score = score;
            best_guess = i;
        }
    }
    
    int target = language(best_guess);
    
    S[target].insert(sample.begin(), sample.end());
}

Compilation message

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:24:15: error: missing template arguments before '=' token
   24 |          hash = 0;
      |               ^
lang.cpp:26:18: error: missing template arguments before '=' token
   26 |             hash = (hash * a + E[i + j]) % b;
      |                  ^
lang.cpp:26:26: error: missing template arguments before '*' token
   26 |             hash = (hash * a + E[i + j]) % b;
      |                          ^
lang.cpp:28:27: error: missing template arguments before ')' token
   28 |         sample.insert(hash);
      |                           ^