답안 #1064960

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1064960 2024-08-18T20:12:45 Z DeathIsAwe 비밀 (JOI14_secret) C++14
0 / 100
324 ms 8320 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
int bollocks[1000][1000], divider[129], arr[1000], en;


void solve(int x, int y) {
  int mid = (x + y) / 2;
  bollocks[mid][mid] = arr[mid]; bollocks[mid + 1][mid + 1] = arr[mid + 1];
  for (int i = mid - 1; i >= x; i--) {
    bollocks[i][mid] = Secret(arr[i], bollocks[i + 1][mid]);
  }
  for (int i = mid + 2; i <= y; i++) {
    bollocks[mid + 1][i] = Secret(bollocks[mid + 1][i - 1], arr[i]);
  }


  if (x < mid) {
    solve(x, mid);
  }
  if (y > mid + 1) {
    solve(mid + 1, y);
  }
}


void Init(int n, int a[]) {
  en = n;
  for (int i=0;i<n;i++) {
    arr[i] = a[i];
  }
  solve(0, n - 1);
}


int Query(int L, int R) {
  if (L == R) {
    return arr[L];
  }


  int top = en - 1, bottom = 0, mid;
  while (true) {
    mid = (top + bottom) / 2;
    if (L > mid + 1) {
      bottom = mid;
    } else if (R < mid) {
      top = mid;
    } else {
      break;
    }
  }


  if (R == mid) {
    return bollocks[L][R];
  } else if (L == mid + 1) {
    return bollocks[L][R];
  } else {
    return Secret(bollocks[L][mid], bollocks[mid + 1][R]);
  }
}

# 결과 실행 시간 메모리 Grader output
1 Incorrect 81 ms 4440 KB Wrong Answer: Query(431, 481) - expected : 557932730, actual : 536870912.
2 Correct 92 ms 4432 KB Output is correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 1
3 Correct 87 ms 4428 KB Output is correct - number of calls to Secret by Init = 3595, maximum number of calls to Secret by Query = 1
4 Incorrect 305 ms 8276 KB Wrong Answer: Query(384, 458) - expected : 896057572, actual : 536870912.
5 Incorrect 305 ms 8320 KB Wrong Answer: Query(263, 292) - expected : 653448456, actual : 536870912.
6 Incorrect 314 ms 8276 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 0.
7 Correct 313 ms 8184 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
8 Correct 316 ms 8272 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
9 Correct 324 ms 8276 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
10 Correct 313 ms 8080 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1