Submission #1030008

# Submission time Handle Problem Language Result Execution time Memory
1030008 2024-07-21T15:47:55 Z Tob Languages (IOI10_languages) C++14
0 / 100
10000 ms 99388 KB
#include <bits/stdc++.h>

#include "grader.h"
#include "lang.h"

#define F first
#define S second
#define all(x) x.begin(), x.end()
#define pb push_back
#define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> sc;

const int siz = 100, le = 5, B = 31337, mod1 = 1e9 + 7, mod2 = 1e9 + 9;

unordered_map <ll, string> m;

sc score(ll h, int c) {
	sc res(56, 0);
	for (auto i : m[h]) res[i] += c*c;
	return res;
}

void excerpt(int* arr) {
	sc res(56, 0);
	for (int i = 0; i < siz; i++) {
		pii h = {0, 0};
		for (int j = i; j < min(siz, i+le); j++) {
			h.F = (h.F*B+arr[j])%mod1;
			h.S = (h.S*B+arr[j])%mod2;
			sc d = score(((ll)h.F << 32) + h.S, j-i+1);
			for (int k = 0; k < 56; k++) res[k] += d[k];
		}
	}
	int x = 0;
	for (int i = 1; i < 56; i++) if (res[i] > res[x]) x = i;
	int y = language(x);
	for (int i = 0; i < siz; i++) {
		pll h = {0, 0};
		for (int j = i; j < min(siz, i+le); j++) {
			h.F = (h.F*B+arr[j])%mod1;
			h.S = (h.S*B+arr[j])%mod2;
			m[((ll)h.F << 32) + h.S] += (char)y;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Execution timed out 10029 ms 99388 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 10034 ms 98608 KB Time limit exceeded
2 Halted 0 ms 0 KB -