Submission #834412

#TimeUsernameProblemLanguageResultExecution timeMemory
834412serifefedartarSecret (JOI14_secret)C++17
0 / 100
20079 ms6328 KiB
#include "secret.h" #include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0);cin.tie(0); typedef long long ll; #define f first #define s second #define MOD 1000000007 #define LOGN 20 #define MAXN 200005 int ranges[1005][1005]; int n; void build(int l, int r, int A[]) { if (l > r) return ; int mid = (l+r)/2; ranges[mid][mid] = A[l]; for (int i = mid-1; i >= l; i--) ranges[i][mid] = Secret(ranges[i+1][mid], A[i]); for (int i = mid+1; i <= r; i++) ranges[mid][i] = Secret(ranges[mid][i-1], A[i]); build(l, mid, A); build(mid+1, r, A); } void Init(int N, int A[]) { build(0, N-1, A); n = N; } int Query(int L, int R) { int now_l = 0; int now_r = n-1; while (now_l <= now_r) { int mid = (now_l+now_r)/2; if (L == mid || R == mid) return ranges[mid][R]; if (L > mid) now_l = mid+1; else if (R < mid) now_r = mid-1; } }

Compilation message (stderr)

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