Submission #867618

# Submission time Handle Problem Language Result Execution time Memory
867618 2023-10-29T02:20:04 Z Matjaz Languages (IOI10_languages) C++14
Compilation error
0 ms 0 KB
#include <stdlib.h>
#include <stdio.h>
#include <set>
#include <vector>

using namespace std;

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

#define SZ 100

//vector<int> count()[56];
//set<pair<int,int> > S[56];
//set<pair<int,pair<int,int> > > S[56];
set<pair<pair<int,int>,pair<int,int> > > S[56];
int L = 56;
int total = 0;
int win = 0;

int winsingle = 0;
int totalsingle = 0;


void excerpt(int *E) {
    total += 1;
    
    set<pair<pair<int,int>,pair<int,int> > > sample;
    for (int i=0;i<97;i++) sample.insert(make_pair(make_pair(E[i], E[i+1]), make_pair(E[i+2], E[i+3])));
    
    int best_score = 0;
    int best_guess = 0;
    int best_count = 0;
    
    vector<int> scores(L);
    
    for (int i=0;i<L;i++){
        
        set<pair<pair<int,int>,pair<int,int> > > intersect;
        set_intersection(sample.begin(), sample.end(), S[i].begin(), S[i].end(),
                         std::inserter(intersect, intersect.begin()));
        
        int score = intersect.size();
        
        scores[i] = score;
        
        if (best_score == score) best_count++;
        
        if (best_score < score){
            best_score = score;
            best_guess = i;
            best_count = 1;
        }
    }
    
    int target = language(best_guess);
    
    if (target == best_guess) win++;
    if (best_count == 1) totalsingle++;
    if (target == best_guess && best_count == 1) winsingle++;
    
    /*printf("%0.2lf%%\n",100.0*win/total);
    if (target == best_guess) printf("WIN\n"); else printf("FAIL\n");
    printf("Sample letters: %ld\n", sample.size());
    printf("Best count: %d\n", best_count);
    if (totalsingle > 0) printf("Win single: %0.2lf%%\n",100.0*winsingle/totalsingle);
    printf("Win multiple: %0.2lf%%\n",100.0*(win - winsingle)/(total -totalsingle));
    for (int i=0;i<L;i++) printf("%d ", scores[i]);
    printf("\n\n");*/
    
    
    
    S[target].insert(sample.begin(), sample.end());
}

Compilation message

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:40:9: error: 'set_intersection' was not declared in this scope
   40 |         set_intersection(sample.begin(), sample.end(), S[i].begin(), S[i].end(),
      |         ^~~~~~~~~~~~~~~~