제출 #865999

#제출 시각아이디문제언어결과실행 시간메모리
865999lolismek비밀 (JOI14_secret)C++14
0 / 100
388 ms4608 KiB
#include "secret.h" #include <vector> #include <iostream> using namespace std; const int NMAX = 1000; int n; int a[NMAX + 1]; int dp[10][NMAX + 1]; void divide(int level, int l, int r){ if(l == r){ dp[level][l] = a[l]; return; } int mid = (l + r) / 2; dp[level][mid] = a[mid]; for(int i = mid - 1; i >= l; i--){ dp[level][i] = Secret(a[i], dp[level][i + 1]); } dp[level][mid + 1] = a[mid + 1]; for(int i = mid + 2; i <= r; i++){ dp[level][i] = Secret(dp[level][i - 1], a[i]); } divide(level + 1, l, mid); divide(level + 1, mid + 1, r); } void Init(int N, int A[]){ n = N; for(int i = 0; i < N; i++){ a[i] = A[i]; } divide(1, 0, N - 1); } int getAns(int level, int l, int r, int L, int R){ int mid = (l + r) / 2; if(L <= mid && mid <= R){ return Secret(dp[level][L], dp[level][R]); } } int Query(int L, int R){ if(L == R){ return a[L]; } return getAns(1, 0, n - 1, L, R); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

secret.cpp: In function 'int getAns(int, int, int, int, int)':
secret.cpp:49:1: warning: control reaches end of non-void function [-Wreturn-type]
   49 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...