Submission #39667

#TimeUsernameProblemLanguageResultExecution timeMemory
39667smu201111192Languages (IOI10_languages)C++14
87 / 100
3779 ms1448 KiB
#include <stdlib.h>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
using namespace std;
#include "grader.h"
#include "lang.h"
const int MAXN = 56;
#define SZ 100
#define N 100
const int lim = 100;
static char lang[20], lan[100][20];
map<int,int> dic[MAXN];
map<pair<int,int>,int>  d[MAXN];
static int lnum, i,j,k,n,nl, uni[N], right, tot;

vector<pair<int,int> > v[MAXN];
void excerpt(int *E) {
    vector<pair<int,int> > vc;
    vector<pair<int,int> > vc2;
    vc.push_back(make_pair(0,rand()%MAXN));
    vc2.push_back(make_pair(0,rand()%MAXN));
    for(int i=0;i<MAXN;i++){
        if(v[i].size() == 0) continue;
        int occ = 0;
        for(int j=0;j<SZ;j++){
            for(int k = 0; k < v[i].size();k++){  //E[j] ---> v[i][k]에서 찾는다.
                if(E[j] == v[i][k].second){
                    occ += (lim- k +1);
                    break;
                }
            }
        }
        vc.push_back(make_pair(occ,i));
    }
    sort(vc.begin(),vc.end()); reverse(vc.begin(),vc.end());
    int cand = vc[0].second;
    int ans = language(cand);
    for(int i=0;i<100;i++){
        dic[ans][E[i]]++;
    }
    v[ans].clear();
    for(auto it : dic[ans]){
        v[ans].push_back(make_pair(it.second,it.first));
    }
    sort(v[ans].begin(),v[ans].end());
    reverse(v[ans].begin(),v[ans].end());
    while(v[ans].size() > lim) v[ans].pop_back();
}

Compilation message (stderr)

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:29:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int k = 0; k < v[i].size();k++){  //E[j] ---> v[i][k]에서 찾는다.
                            ~~^~~~~~~~~~~~~
lang.cpp: At global scope:
lang.cpp:17:45: warning: 'tot' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                                             ^~~
lang.cpp:17:38: warning: 'right' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                                      ^~~~~
lang.cpp:17:30: warning: 'uni' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                              ^~~
lang.cpp:17:26: warning: 'nl' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                          ^~
lang.cpp:17:24: warning: 'n' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                        ^
lang.cpp:17:22: warning: 'k' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                      ^
lang.cpp:17:20: warning: 'j' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                    ^
lang.cpp:17:18: warning: 'i' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                  ^
lang.cpp:17:12: warning: 'lnum' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
            ^~~~
lang.cpp:14:23: warning: 'lan' defined but not used [-Wunused-variable]
 static char lang[20], lan[100][20];
                       ^~~
lang.cpp:14:13: warning: 'lang' defined but not used [-Wunused-variable]
 static char lang[20], lan[100][20];
             ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...