# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
70292 |
2018-08-22T14:48:44 Z |
MladenP |
Secret (JOI14_secret) |
C++17 |
|
0 ms |
0 KB |
#include "secret.h"
#define mid (l+r)/2
#define I int
#define G return
#define S Secret
int n,i,a[1010],d[1010][1010];
void Z(int l, int r) {
if(l >= r) return;
for(i = mid+1; i <= r; i++) d[mid][i] = S(d[mid][i-1], a[i]);
for(i = mid-2; i >= l; i--) d[i][mid-1] = S(a[i], d[i+1][mid-1]);
Z(l, mid-1);Z(mid, r);
}
int query(int l, int r, int L, int R) {
if(L == mid) return d[mid][R];
if(mid < L) return query(mid, r, L, R);
if(mid > R) return query(l, mid-1, L, R);
return S((d[L][mid-1],d[mid][R]);
}
void Init(I N, I *A){for(i=0,n=N-1;i<N;i++)a[i]=A[i],d[i][i]=a[i];Z(0,n);}I Query(I L,I R){G query(0,n,L,R);}
Compilation message
secret.cpp: In function 'int query(int, int, int, int)':
secret.cpp:17:22: warning: left operand of comma operator has no effect [-Wunused-value]
return S((d[L][mid-1],d[mid][R]);
~~~~~~~~~~^
secret.cpp:17:34: error: expected ')' before ';' token
return S((d[L][mid-1],d[mid][R]);
^