답안 #391251

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
391251 2021-04-18T10:07:22 Z Vladth11 비밀 (JOI14_secret) C++14
0 / 100
519 ms 8256 KB
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debug_with_space(x) cerr << #x << " " << x << " "
#include "secret.h"
 
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;
typedef pair <long double, pii> muchie;
 
const ll NMAX = 300001;
const ll INF = (1LL << 60);
const ll MOD = 998244353;
const ll BLOCK = 225;
const ll base = 31;
const ll nr_of_bits = 21;
 
int table[1001][1001], n;
 
void divide(int l, int r){
  	if(l == r || l > r)
      return;
    int mid = (l + r) / 2;
    for(int i = mid - 1; i >= l; i--){
        table[i][mid] = Secret(table[i + 1][mid], table[i][i]);
    }
    for(int i = mid + 2; i <= r; i++){
        table[mid + 1][i] = Secret(table[mid + 1][i - 1], table[i][i]);
    }
    divide(l, mid);
    divide(mid + 1, r);
}
 
void Init(int N, int A[]) {
  n = N;
  for(int i = 0; i < N; i++)
    table[i][i] = A[i];
  divide(0, N - 1);
}
 
int q(int st, int dr, int l, int r){
    int mid = (st + dr) / 2;
    if(l <= mid && mid + 1 <= r){
        return Secret(table[l][mid], table[mid + 1][r]);
    }
    if(r <= mid){
        return q(st, mid, l, r);
    }
    if(l > mid){
        return q(mid + 1, dr, l, r);
    }
}
 
int Query(int L, int R) {
  	if(L == R)
      return table[L][R];
    return q(0, n - 1, L, R);
}
 

Compilation message

secret.cpp: In function 'int q(int, int, int, int)':
secret.cpp:52:1: warning: control reaches end of non-void function [-Wreturn-type]
   52 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 134 ms 4360 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 538256673.
2 Incorrect 132 ms 4380 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 137 ms 4344 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 519 ms 8132 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 499 ms 8184 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 499 ms 8108 KB Wrong Answer: Query(747, 749) - expected : 244228265, actual : 935077363.
7 Incorrect 496 ms 8168 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 499 ms 8256 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 500 ms 8120 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 500 ms 8124 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.