Submission #138979

# Submission time Handle Problem Language Result Execution time Memory
138979 2019-07-31T05:50:28 Z baluteshih Languages (IOI10_languages) C++14
96 / 100
7872 ms 10276 KB
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <unordered_set>
#include <bitset>
#include <chrono>
#define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define ET cout << "\n"
#define F first
#define S second
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define MEM(i,j) memset(i,j,sizeof i)
#define DB(a,s,e) {for(int i=s;i<e;++i) cout << a[i] << " ";ET;}
using namespace std;
typedef long long ll;
 
#include "grader.h"
#include "lang.h"
 
const int SZ=100;
const ll P=65537,MOD=1e9+7;
vector<int> ap;
unordered_set<ll> having[56][3]; 
bitset<56> vis;
 
int query(int x)
{
	int rt=language(x);
	return rt;
}
 
int cal(int x,int *E)
{
	int rt=0;
	for(int i=0;i<SZ;++i)
		rt+=(having[x][0].find(E[i])!=having[x][0].end());
	for(int i=0;i+1<SZ;++i)
		rt+=(having[x][1].find((ll)E[i]+(ll)E[i+1]*P)!=having[x][1].end());
	for(int i=0;i+2<SZ;++i)
		rt+=(having[x][2].find((ll)E[i]+(ll)E[i+1]*P+(ll)E[i+2]*P*P)!=having[x][2].end());
	return rt;
}
 
void excerpt(int *E)
{
	srand(chrono::system_clock::now().time_since_epoch().count());
	int t;
	if(ap.empty()) t=query(0);
	else
	{
		int mx=-1;
		for(int i:ap)
		{
			int tmp=cal(i,E);
			if(tmp>mx) mx=tmp,t=i;
		}
		t=query(t);
	}
	if(!vis[t]) vis[t]=1,ap.pb(t);
	for(int i=0;i<SZ;++i)
		having[t][0].insert(E[i]);
	for(int i=0;i+1<SZ;++i)
		having[t][1].insert((ll)E[i]+(ll)E[i+1]*P);
	for(int i=0,r;i<25;++i)
		r=rand()%(SZ-2),having[t][2].insert((ll)E[r]+(ll)E[r+1]*P+(ll)E[r+2]*P*P);
}
# Verdict Execution time Memory Grader output
1 Correct 7515 ms 10276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 7872 ms 10224 KB Output is partially correct - 87.55%