//#include <stdlib.h>
//#include <stdio.h>
//#include <cmath>
//#include <unordered_map>
//
//#include "grader.h"
//#include "lang.h"
//
//#define SZ 100
//
//using namespace std;
//
//typedef long long ll;
//
//const int M = 100;
//const int N = 2;
//const int K = 15;
//int a[65555][65];
//int y[65];
//unordered_map<ll, int> ma;
//int now = 1;
////int cnt = 0;
//
//void excerpt(int *E)
//{
//// int mx2 = -1, mi2 = 0;
//// for(int i = 0; i < 56; i++) y[i] = 0;
//// for(int i = 0; i < 100; i++)
//// {
//// int mx = -1, mi = 0, mx2 = -1;
//// for(int j = 0; j < 56; j++)
//// {
//// if(x[E[i]][j] > mx) mx = x[E[i]][j], mi = j;
//// else if(x[E[i]][j] > mx2) mx2 = x[E[i]][j];
//// }
//// y[mi] += M + N * sqrt(mx - mx2) + K * sqrt(sqrt(mx - mx2));
//// }
//// mx2 = -1;
//// for(int i = 0; i < 56; i++)
//// {
//// if(y[i] > mx2) mx2 = y[i], mi2 = i;
//// }
// int mx = -1, mi = -1;
//// for(int i = 0; i < 56; i++)
//// {
//// int cnt = 0;
//// for(int j = 0; j < 1; j++)
//// {
//// ll t = E[j] * 65536LL * 65536LL + E[j + 1] * 65536LL + E[j + 2];
//// ll t2 = E[j + 1] * 65536LL + E[j + 2];
//// cnt += 5 * x.count(t * 100 + i);
//// }
//// for(int j = 5; j < 10; j++)
//// {
//// ll t = E[j] * 65536LL * 65536LL + E[j + 1] * 65536LL + E[j + 2];
//// ll t2 = E[j + 1] * 65536LL + E[j + 2];
//// cnt += 1 * x.count(t * 100 + i);
//// }
//// for(int j = 95; j < 100; j++)
//// {
//// ll t = E[j] * 65536LL * 65536LL + E[j + 1] * 65536LL + E[j + 2];
//// ll t2 = E[j + 1] * 65536LL + E[j + 2];
//// cnt += 1 * x.count(t * 100 + i);
//// }
//// if(mx < cnt) mx = cnt, mi = i;
//// }
// ll cnt[59];
// for(int i = 0; i < 56; i++) cnt[i] = 0;
// for(int i = 0; i < 100; i++)
// {
// int mx1 = -1, mx2 = -1, mi = -1;
// int mx3 = 1;
// for(int j = 0; j < 56; j++)
// {
// mx3 += a[E[i]][j];
// if(mx1 < a[E[i]][j]) mx2 = mx1, mx1 = a[E[i]][j], mi = j;
// else if(mx2 < a[E[i]][j]) mx2 = a[E[i]][j];
// }
// cnt[mi] += (mx1 * 50 / (mx3)) * (mx1 * 50 / (mx3));
// if(i == 99) break;
// for(ll j = 0; j < 56; j++) cnt[j] += 70000 * (a[E[i]][j]) / now + 700000 * (ma[E[i] * 6553600 + E[i + 1] * 100 + j]) / now;
// }
// int mxx = -1, mii = 0;
// for(int i = 0; i < 56; i++)
// {
// if(mxx < cnt[i]) mxx = cnt[i], mii = i;
// }
// int k = language(mii);
// for(int i = 0; i < 100; i++)
// {
//// ll t = E[i] * 65536ULL * 65536ULL + E[i + 1] * 65536ULL + E[i + 2];
//// x.insert(t * 100 + k);
//// ll t2 = E[i] * 65536LL + E[i + 1];
//// xxx.insert(t2 * 100 + k);
// a[E[i]][k]++;
// if(i < 99) ma[E[i] * 6553600 + E[i + 1] * 100 + k] += 1, now++;
// }
//// cnt++;
//}
#include <stdlib.h>
#include <stdio.h>
//#include <cmath>
#include <set>
//#include <unordered_map>
#include "grader.h"
#include "lang.h"
#define SZ 100
using namespace std;
typedef unsigned long long ll;
const int M = 100;
const int N = 2;
const int K = 15;
//unordered_map<ll, int> x[57];
set<ll> x[57];
//map<pair<ll, int>, int> xxx;
//set<pair<ll, int>> x;
//set<pair<ll, int>> xxx;
//int y[65];
//int cnt = 0;
ll a[57][65555];
void excerpt(int *E)
{
// int mx2 = -1, mi2 = 0;
// for(int i = 0; i < 56; i++) y[i] = 0;
// for(int i = 0; i < 100; i++)
// {
// int mx = -1, mi = 0, mx2 = -1;
// for(int j = 0; j < 56; j++)
// {
// if(x[E[i]][j] > mx) mx = x[E[i]][j], mi = j;
// else if(x[E[i]][j] > mx2) mx2 = x[E[i]][j];
// }
// y[mi] += M + N * sqrt(mx - mx2) + K * sqrt(sqrt(mx - mx2));
// }
// mx2 = -1;
// for(int i = 0; i < 56; i++)
// {
// if(y[i] > mx2) mx2 = y[i], mi2 = i;
// }
int mx = -1, mi = -1;
for(int i = 0; i < 56; i++)
{
int cnt = 0;
for(int j = 0; j < 97; j++)
{
ll t = E[j] * 65536ULL * 65536ULL * 65536ULL + E[j + 1] * 65536ULL * 65536ULL + E[j + 2] * 65536ULL + E[j + 3];
// ll t2 = E[j] * 65536ULL * 65536ULL + E[j + 1] * 65536ULL + E[j + 2];
ll t2 = x[i].count(t);
// ll t2 = x.count({t, i});
cnt += (t2 > 0);// + xxx.count({t2, i});
cnt += (a[i][E[j]]>0);
}
if(mx < cnt) mx = cnt, mi = i;
}
int k = language(mi);
for(int i = 0; i < 97; i++)
{
ll t = E[i] * 65536ULL * 65536ULL * 65536ULL + E[i + 1] * 65536ULL * 65536ULL + E[i + 2] * 65536ULL + E[i + 3];
// x[k][t] += 1;
x[k].insert(t);
//ll t2 = E[i] * 65536ULL * 65536ULL + E[i + 1] * 65536ULL + E[i + 2];
//xxx.insert({t2, k});
a[k][E[i]]++;
}
// cnt++;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6664 ms |
27740 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6729 ms |
27800 KB |
Output is correct - 91.08% |