Submission #867619

# Submission time Handle Problem Language Result Execution time Memory
867619 2023-10-29T02:21:48 Z Matjaz Languages (IOI10_languages) C++14
0 / 100
10000 ms 20432 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

//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());
}
# Verdict Execution time Memory Grader output
1 Execution timed out 10036 ms 20220 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 10050 ms 20432 KB Time limit exceeded
2 Halted 0 ms 0 KB -