답안 #391257

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
391257 2021-04-18T10:16:14 Z Vladth11 비밀 (JOI14_secret) C++14
0 / 100
20000 ms 8184 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, 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(st == dr)
      return table[st][dr];
    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) {
    return q(0, n - 1, L, R);
}

Compilation message

secret.cpp: In function 'int q(int, int, int, int)':
secret.cpp:54:1: warning: control reaches end of non-void function [-Wreturn-type]
   54 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 20014 ms 4240 KB Time limit exceeded
2 Execution timed out 20031 ms 4336 KB Time limit exceeded
3 Execution timed out 20035 ms 4284 KB Time limit exceeded
4 Execution timed out 20083 ms 8096 KB Time limit exceeded
5 Execution timed out 20082 ms 8132 KB Time limit exceeded
6 Execution timed out 20089 ms 8184 KB Time limit exceeded
7 Execution timed out 20052 ms 8080 KB Time limit exceeded
8 Execution timed out 20065 ms 8132 KB Time limit exceeded
9 Execution timed out 20096 ms 8132 KB Time limit exceeded
10 Execution timed out 20087 ms 8132 KB Time limit exceeded