# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
69449 |
2018-08-20T22:21:18 Z |
MladenP |
Secret (JOI14_secret) |
C++17 |
|
652 ms |
8532 KB |
#include <bits/stdc++.h>
#include "secret.h"
#define STIZE(x) fprintf(stderr, "STIZE%lld\n", x);
#define PRINT(x) fprintf(stderr, "%s = %lld\n", #x, x);
#define NL(x) printf("%c", " \n"[(x)]);
#define lld long long
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mid (l+r)/2
#define endl '\n'
#define all(a) begin(a),end(a)
#define sz(a) int((a).size())
#define LINF 1000000000000000LL
#define INF 1000000000
#define EPS 1e-9
using namespace std;
#define MAXN 1000
int n, a[MAXN], d[MAXN][MAXN];
void init(int l, int r) {
if(r < l) return;
d[mid][mid] = a[mid];
for(int i = mid+1; i <= r; i++) d[mid][i] = Secret(d[mid][i-1], a[i]);
d[mid-1][mid-1] = a[mid-1];
for(int i = mid-2; i >= l; i--) d[i][mid-1] = Secret(a[i], d[i+1][mid-1]);
init(l, mid-1); init(mid+1, r);
}
void Init(int N, int A[]) {
n = N;
for(int i = 0; i < n; i++) a[i] = A[i];
init(0, N-1);
}
int query(int l, int r, int L, int R) {
if(L <= mid-1 && mid <= R) return Secret(d[L][mid-1],d[mid][R]);
if(mid < L) return query(mid+1, r, L, R);
if(R < mid) return query(l, mid-1, L, R);
}
int Query(int L, int R) {
if(L == R) return a[L];
if(L+1 == R) return Secret(a[L], a[R]);
return query(0, n-1, L, R);
}
Compilation message
secret.cpp: In function 'int query(int, int, int, int)':
secret.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
159 ms |
4344 KB |
Wrong Answer: Query(255, 409) - expected : 307522235, actual : 255. |
2 |
Incorrect |
162 ms |
4480 KB |
Wrong Answer: Query(127, 153) - expected : 342921603, actual : 127. |
3 |
Incorrect |
166 ms |
4496 KB |
Wrong Answer: Query(272, 278) - expected : 620510644, actual : 272. |
4 |
Incorrect |
646 ms |
8484 KB |
Wrong Answer: Query(374, 396) - expected : 402362963, actual : 374. |
5 |
Incorrect |
619 ms |
8484 KB |
Wrong Answer: Query(937, 999) - expected : 615241818, actual : 937. |
6 |
Incorrect |
643 ms |
8532 KB |
Wrong Answer: Query(811, 813) - expected : 25091616, actual : 811. |
7 |
Correct |
652 ms |
8532 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
647 ms |
8532 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |
9 |
Correct |
635 ms |
8532 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
604 ms |
8532 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |