# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
39650 | 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 <stdlib.h>
#include <stdio.h>
#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
set<vector<int> > mp[MAXN];
long long f[5] = {0,-100,-100000,-10000000,-1000000000};
long long penalty(int *E,int idx,int cnt){
if(mp[idx].size() == 0)return 1e18;
//1개씩 ,2개씩 , 3개씩, 4개씩
long long sum = 0;
for(int i=0;i<SZ;i++){
vector<int> temp;
for(int j=0;j<cnt;j++){
if(i+j >= SZ) break;
temp.push_back(E[i+j]);
}
if(mp[idx].find(temp) != mp[idx].end()){
sum += f[cnt];
}
}
return sum;
}
void add(int *E,int idx,int cnt){
for(int i=0;i<SZ;i++){
vector<int> temp;
for(int j=0;j<cnt;j++){
if(i+j >= SZ) break;
temp.push_back(E[i+j]);
}
mp[idx].insert(temp);
}
}
void excerpt(int *E) {
vector<pair<long long,long long> > vc;
for(int i=0;i<MAXN;i++){
long long p = 0;
for(int k = 1;k<=2;k++){
p += penalty(E,i,k);
}
vc.push_back(make_pair(p,i));
}
sort(vc.begin(),vc.end());
long long go = vc[0].second;
int ans = language(go);
for(int k=1;k<=2;k++){
add(E,ans,k);
}
}