#include <stdlib.h>
#include <stdio.h>
#include "grader.h"
#include "lang.h"
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define sortv(v) sort(all(v))
#define uniqv(v) (v).erase(unique(all(v)), (v).end())
#define pb push_back
#define FI first
#define SE second
#define lb lower_bound
#define ub upper_bound
#define test 1
#define TEST if(test)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
const int MOD = 1000000007; // 998244353
const int INF = 2e9;
const ll INFLL = 1e18;
const int MAX_N = 10000;
const int MAX_K = 70000;
#define SZ 100
#define LAN 56
int idx = 0;
int lan[MAX_N+10];
map<ll, int> mp;
vector<ll> v[LAN+1];
int cnt[MAX_K+1];
vector<ll> vt;
ll mx;
int c1;
int space = 0;
bool in(int x, ll y){
if(v[x].empty()) return false;
int s = 0, e = v[x].size()-1, m;
while(s<e){
m = (s+e)/2;
if(v[x][m]<y){
s = m+1;
}else{
e = m;
}
}
return (v[x][s]==y);
}
void excerpt(int *E) {
idx++;
if(idx<=3){
for(int i=0; i<SZ; i++){
cnt[E[i]]++;
}
for(int i=0; i<MAX_K; i++){
if(cnt[i]>cnt[space]) space = i;
}
}
for(int i=0; i<SZ-1; i++){
if(E[i]==space) continue;
if(E[i+1]==space){
i++;
}else{
vt.pb(((ll)E[i]<<(ll)16)+(ll)E[i+1]);
}
}
sort(vt.begin(), vt.end());
vt.erase(unique(vt.begin(), vt.end()), vt.end());
mx = 0; c1 = 0;
for(int j=0; j<LAN; j++){
int c = 0;
for(int i=0; i<vt.size(); i++){
if(in(j, vt[i])){
c++;
}
}
if(c>c1){
c1 = c; mx = j;
}
}
int ask = mx;
lan[idx] = language(ask);
while(!vt.empty()){
v[lan[idx]].pb(vt.back()); vt.pop_back();
}
sort(v[lan[idx]].begin(), v[lan[idx]].end());
//cout<<idx<<" "<<mx<<" "<<ask<<" "<<lan[idx]<<endl;
}
Compilation message
lang.cpp: In function 'void excerpt(int*)':
lang.cpp:86:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<vt.size(); i++){
~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6634 ms |
6508 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
6668 ms |
6596 KB |
Output is partially correct - 71.86% |