Submission #338424

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3384242020-12-23 05:54:03KoDXylophone (JOI18_xylophone)C++17
100 / 100
157 ms98540 KiB
#include <bits/stdc++.h>
template <class T>
using Vec = std::vector<T>;
#ifdef __APPLE__
int query(int, int);
void answer(int, int);
#else
#include "xylophone.h"
#endif
void solve(int N) {
Vec<Vec<int>> memo(N, Vec<int>(N, -1));
const auto ask = [&](int s, int t) {
if (memo[s][t] != -1) {
return memo[s][t];
}
return memo[s][t] = query(s + 1, t + 1);
};
const auto fill = [&](Vec<int> &vec) {
for (int i = 2; i < N; ++i) {
const auto a = ask(i - 2, i - 1);
const auto b = ask(i - 1, i);
const auto c = ask(i - 2, i);
if (vec[i - 2] < vec[i - 1]) {
if (a + b == c) {
vec[i] = vec[i - 1] + b;
}
else {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...