답안 #785018

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
785018 2023-07-16T23:21:27 Z tvladm2009 비밀 (JOI14_secret) C++17
0 / 100
388 ms 8336 KB
#include "secret.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 1000 + 7;

int hint[N][N];

void run(int l, int r) {
  if (r - l <= 1) {
    return;
  }
  int m = (l + r) / 2;
  for (int i = m - 1; i >= l; i--) {
    if (hint[i][m] == -1) {
      hint[i][m] = Secret(hint[i][i + 1], hint[i + 1][m]);
    }
  }
  for (int i = m + 1; i <= r; i++) {
    if (hint[m][i] == -1) {
      hint[m][i] = Secret(hint[m][i - 1], hint[i - 1][i]);
    }
  }
  run(l, m);
  run(m, r);
}

void Init(int n, int a[]) {
  for (int i = 0; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      hint[i][j] = -1;
    }
  }
  for (int i = 0; i < n; i++) {
    hint[i][i + 1] = a[i];
  }
  run(0, n);
}

int Query(int l, int r) {
  for (int i = l + 1; i <= r; i++) {
    if (hint[l][i] != -1 && hint[i + 1][r + 1] != -1) {
      return Secret(hint[l][i], hint[i + 1][r + 1]);
    }
  }
  return hint[l][r + 1];
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 103 ms 4424 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 1381276.
2 Incorrect 104 ms 4424 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : -1.
3 Incorrect 102 ms 4436 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : -1.
4 Incorrect 382 ms 8336 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : -1.
5 Incorrect 388 ms 8308 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : -1.
6 Incorrect 385 ms 8256 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 304107776.
7 Incorrect 375 ms 8268 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : -1.
8 Incorrect 374 ms 8268 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : -1.
9 Incorrect 385 ms 8200 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : -1.
10 Incorrect 380 ms 8264 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : -1.