답안 #1064899

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


void bollocksolve(int x, int y) {
  for (int i=x;i<=y;i++) {
    bollocks[i][i] = arr[i];
    for (int j=i+1;j<=y;j++) {
      bollocks[i][j] = Secret(bollocks[i][j - 1], arr[j]);
    }
  }
}


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


  if (depth < 7) {
    if (x < mid) {
      solve(x, mid, depth + 1);
    }
    if (y > mid + 1) {
      solve(mid + 1, y, depth + 1);
    }
  } else {
    if (x < mid) {
      bollocksolve(x, mid);
    }
    if (y > mid + 1) {
      bollocksolve(mid + 1, y);
    }
  }
}


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


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


  if (exist[mid]) {
    if (L == mid) {
      return conquer[R][L];
    } else if (R == mid) {
      return conquer[L][R];
    }
    //cout << conquer[L][mid] << ' ' << conquer[R][mid] << ' ';
    return Secret(conquer[L][mid], conquer[R][mid]);
  } else {
    return bollocks[L][R];
  }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 79 ms 10832 KB Wrong Answer: Query(431, 481) - expected : 557932730, actual : 0.
2 Incorrect 79 ms 10836 KB Wrong Answer: Query(127, 153) - expected : 342921603, actual : 708520034.
3 Incorrect 83 ms 10840 KB Wrong Answer: Query(128, 153) - expected : 959658850, actual : 764916540.
4 Incorrect 305 ms 12116 KB Wrong Answer: Query(384, 458) - expected : 896057572, actual : 0.
5 Incorrect 301 ms 12112 KB Wrong Answer: Query(263, 292) - expected : 653448456, actual : 0.
6 Incorrect 312 ms 12212 KB Wrong Answer: Query(200, 208) - expected : 277813445, actual : 0.
7 Partially correct 309 ms 12096 KB Output isn't correct - number of calls to Secret by Init = 10162, maximum number of calls to Secret by Query = 1
8 Partially correct 312 ms 12216 KB Output isn't correct - number of calls to Secret by Init = 10162, maximum number of calls to Secret by Query = 1
9 Partially correct 309 ms 12116 KB Output isn't correct - number of calls to Secret by Init = 10162, maximum number of calls to Secret by Query = 1
10 Partially correct 322 ms 12116 KB Output isn't correct - number of calls to Secret by Init = 10162, maximum number of calls to Secret by Query = 1