# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1054347 |
2024-08-12T08:59:10 Z |
phong |
Secret (JOI14_secret) |
C++17 |
|
0 ms |
0 KB |
#include<bits/stdc++.h>
#include "secret.h"
#define ll long long
const int nmax = 1e3+ 5, N = 1e6;
const ll oo = 1e9 + 1, base = 311;
const int lg = 19, M = 10;
const ll mod = 1e9 + 2277, mod2 = 1e9 + 5277;
#define pii pair<int, int>
#define fi first
#define se second
#define endl "\n"
#define debug(a, n) for(int i = 1; i <= n; ++i) cout << a[i] << ' '; cout << "\n";
using namespace std;
int n, a[nmax];
int L[1 << 11][nmax], R[1 << 11][nmax];
int Secret(int a, int b){
}
void build(int id, int l, int r){
if(l == r)return;
int mid = r + l >> 1;
L[id][mid] = a[mid];
R[id][mid + 1] = a[mid + 1];
for(int i = mid - 1; i >= l; --i) L[id][i] = Secret(L[id][i + 1], a[i]);
for(int i = mid + 2; i <= r; ++i) R[id][i] = Secret(R[id][i - 1], a[i]);
build(id << 1, l, mid);
build(id << 1| 1, mid + 1, r);
}
int get(int id, int l, int r, int u, int v){
if(l == r) return a[l];
int mid = r + l >> 1;
if(l <= u && v <= r && u <= mid && mid + 1 <= v){
return Secret(L[id][u], R[id][v]);
}
if(mid + 1 > u) return get(id << 1, l, mid, u, v);
if(mid < v) return get(id << 1 | 1, mid + 1, r, u, v);
}
void Init(int NA, int A[]){
n = NA;
for(int i = 1; i <= n; ++i) a[i] = A[i - 1];
build(1, 1, n);
}
int Query(int a, int b){
++a, ++b;
return get(1, 1, n, a, b);
}
Compilation message
secret.cpp: In function 'int Secret(int, int)':
secret.cpp:20:1: warning: no return statement in function returning non-void [-Wreturn-type]
20 | }
| ^
secret.cpp: In function 'void build(int, int, int)':
secret.cpp:23:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
23 | int mid = r + l >> 1;
| ~~^~~
secret.cpp: In function 'int get(int, int, int, int, int)':
secret.cpp:33:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
33 | int mid = r + l >> 1;
| ~~^~~
secret.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
39 | }
| ^
/usr/bin/ld: /tmp/ccv3aey1.o: in function `Secret(int, int)':
secret.cpp:(.text.unlikely+0x0): multiple definition of `Secret(int, int)'; /tmp/ccshfQH2.o:grader.cpp:(.text+0x2d0): first defined here
collect2: error: ld returned 1 exit status