Submission #39680

#TimeUsernameProblemLanguageResultExecution timeMemory
39680smu201111192Languages (IOI10_languages)C++14
95 / 100
3211 ms38184 KiB

#include "grader.h"
#include "lang.h"
#include <cassert>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#define N 100
using namespace std;
static char lang[20], lan[100][20];
static int lnum, i,j,k,n,nl, uni[N], right, tot;
const int MAXN = 56;
#define SZ 100
int prv1[MAXN][(1<<16)+1];
int prv2[MAXN][(1<<18)+1];
int prv3[MAXN][(1<<18)+1];
int prv4[MAXN][(1<<18)+1];

const long long mod2 = 79378;
long long hash1(int a){
    assert(a>=0);
    return a;
}
long long hash2(int a,int b){
    long long ret = (hash1(a) << 16)| b;
    assert(ret>=0);
    return ret % mod2;
}
long long hash3(int a,int b,int c){
    long long  ret = (hash2(a,b)<<16) | c;
    assert(ret>=0);
    return ret % mod2;
}
long long hash4(int a,int b,int c,int d){
    long long ret = (hash3(a,b,c)<<16) | d;
    assert(ret>=0);
    return ret % mod2;
}
void excerpt(int *E) {
    vector<pair<int,int> > cand;
    for(int j=0;j<MAXN;j++){
        int t = 0;
        for(int i=0;i<100;i++){
            t += prv1[j][hash1(E[i])];
        }
        for(int i=0;i<99;i++){
            t += prv2[j][hash2(E[i],E[i+1])] * 10;
        }
        for(int i=0;i<98;i++){
            t += prv3[j][hash3(E[i],E[i+1],E[i+2])] * 30;
        }
        cand.push_back(make_pair(t,j));
    }
    if(tot > 3000){
        int abc=3;
    }
    sort(cand.begin(),cand.end());
    int q = cand.back().second;
    int ans = language(q);
    
    for(int i=0;i<100;i++){
        prv1[ans][hash1(E[i])] = 1;
    }
    for(int i=0;i<99;i++){
        prv2[ans][hash2(E[i],E[i+1])] = 1;
    }
    for(int i=0;i<98;i++){
        prv3[ans][hash3(E[i],E[i+1],E[i+2])] = 1;
    }
    
}

Compilation message (stderr)

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:58:13: warning: unused variable 'abc' [-Wunused-variable]
         int abc=3;
             ^~~
lang.cpp: At global scope:
lang.cpp:14:38: warning: 'right' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                                      ^~~~~
lang.cpp:14:30: warning: 'uni' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                              ^~~
lang.cpp:14:26: warning: 'nl' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                          ^~
lang.cpp:14:24: warning: 'n' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                        ^
lang.cpp:14:22: warning: 'k' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                      ^
lang.cpp:14:20: warning: 'j' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                    ^
lang.cpp:14:18: warning: 'i' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
                  ^
lang.cpp:14:12: warning: 'lnum' defined but not used [-Wunused-variable]
 static int lnum, i,j,k,n,nl, uni[N], right, tot;
            ^~~~
lang.cpp:13:23: warning: 'lan' defined but not used [-Wunused-variable]
 static char lang[20], lan[100][20];
                       ^~~
lang.cpp:13: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...