# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
39679 | smu201111192 | Languages (IOI10_languages) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#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;
}
}