제출 #155349

#제출 시각아이디문제언어결과실행 시간메모리
155349jhnah917Languages (IOI10_languages)C++14
71 / 100
4018 ms36120 KiB
#include "grader.h" #include "lang.h" #include <bits/stdc++.h> using namespace std; const int n = 100, m = 56; const int mod = 50021; int cnt[57][50505]; int cnt2[57][50505]; int cnt3[57][50505]; int cnt4[57][50505]; int lan[57]; int f(int a, int b){ long long ret = (long long)a << 16; ret |= b; ret %= mod; return ret; } int f(int a, int b, int c){ long long ret = (long long)f(a, b) << 16; ret |= c; ret %= mod; return ret; } int f(int a, int b, int c, int d){ long long ret = (long long)f(a, b, c) << 16; ret |= d; ret %= mod; return ret; } void excerpt(int *arr){ double mx = 0; int idx = 0; for(int i=0; i<m; i++){ double now = 0; for(int j=0; j<n; j++){ now += cnt[i][arr[i]]; if(j >= n-1) continue; now += cnt2[i][f(arr[j], arr[j+1])] * 100; if(j >= n-2) continue; now += cnt3[i][f(arr[j], arr[j+1], arr[j+2])] * 150; if(j >= n-3) continue; now += cnt4[i][f(arr[j], arr[j+1], arr[j+2], arr[j+3])] * 100; } now /= log(lan[i] + 1); if(now > mx){ mx = now; idx = i; } } int ans = language(idx); lan[ans]++; for(int i=0; i<n; i++){ cnt[ans][arr[i]]++; if(i >= n-1) continue; cnt2[ans][f(arr[i], arr[i+1])]++; if(i >= n-2) continue; cnt3[ans][f(arr[i], arr[i+1], arr[i+2])]++; if(i >= n-3) continue; cnt4[ans][f(arr[i], arr[i+1], arr[i+2], arr[i+3])]++; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...