# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
53913 |
2018-07-01T17:51:08 Z |
jovan_b |
Secret (JOI14_secret) |
C++17 |
|
641 ms |
9940 KB |
#include <bits/stdc++.h>
using namespace std;
#include "secret.h"
typedef long double ld;
typedef long long ll;
ll niz[1005];
ll res[1005][1005];
ll n;
ll fajnd(ll l, ll r, ll trl, ll trr){
if(r-l <= 1) return -1;
ll mid = (l+r)/2;
if(l <= trl && trr <= r && trl <= mid && r >= mid+1) return mid;
ll x = fajnd(l, mid, trl, trr);
if(x != -1) return x;
return fajnd(mid+1, r, trl, trr);
}
void process(ll l, ll r){
if(r-l <= 1) return;
ll i = (l+r)/2;
res[i][i] = niz[i];
res[i+1][i+1] = niz[i+1];
for(ll j=i-1; j>=l; j--){
res[j][i] = Secret(niz[j], res[j+1][i]);
}
for(ll j=i+2; j<=r; j++){
res[i+1][j] = Secret(niz[j], res[i+1][j-1]);
}
process(l, i);
process(i+1, r);
}
void Init(int N, int A[]){
n = N;
for(ll i=0; i<N; i++) niz[i] = A[i];
process(0, n-1);
}
int Query(int L, int R){
if(L == R) return niz[L];
if(R == L+1) return Secret(niz[L], niz[R]);
ll i = fajnd(0, n-1, L, R);
return Secret(res[L][i], res[i+1][R]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
164 ms |
4856 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 587620235. |
2 |
Incorrect |
167 ms |
4952 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376. |
3 |
Incorrect |
168 ms |
5016 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820. |
4 |
Incorrect |
641 ms |
9912 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 846921768. |
5 |
Incorrect |
599 ms |
9912 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838. |
6 |
Incorrect |
598 ms |
9912 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 949167361. |
7 |
Incorrect |
597 ms |
9912 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570. |
8 |
Incorrect |
595 ms |
9912 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264. |
9 |
Incorrect |
590 ms |
9940 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135. |
10 |
Incorrect |
609 ms |
9940 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726. |