# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
624469 |
2022-08-08T10:05:40 Z |
erto |
Secret (JOI14_secret) |
C++17 |
|
445 ms |
8464 KB |
#include "secret.h"
#include <bits/stdc++.h>
typedef long long int ll;
#define INF 1000000007
#define INF2 998244353
//#define N (ll)(2e5+ 5)
using namespace std;
int n;
int ans[1005][1005];
void calc(int lb, int rb, int A[]){
int mid = (lb + rb) / 2;
ans[mid][mid] = A[mid - 1];
if(lb == rb)return;
for(int i=mid - 1; i>=lb; i--){
ans[mid][i] = Secret(A[i - 1], ans[mid][i + 1]);
}
ans[mid + 1][mid + 1] = A[mid];
for(int i=mid + 2; i<=rb; i++){
ans[mid + 1][i] = Secret(ans[mid + 1][i - 1], A[i - 1]);
}
calc(lb, mid, A);
calc(mid + 1, rb, A);
}
void Init(int N, int A[]){
n = N;
calc(1, n, A);
}
int Query(int L, int R){
L++;
R++;
int a = 1, b = n;
if(L == R)return ans[L - 1][L - 1];
else{
while(a < b){
int mid = (a + b) / 2;
if(L <= mid && mid < R){
return Secret(ans[mid][L], ans[mid][R]);
}
else if(mid == R){
return ans[mid][L];
}
else if(mid < L){
a = mid + 1;
}
else{
b = mid;
}
}
}
}
Compilation message
secret.cpp: In function 'int Query(int, int)':
secret.cpp:57:1: warning: control reaches end of non-void function [-Wreturn-type]
57 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
115 ms |
4388 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 805576266. |
2 |
Incorrect |
114 ms |
4480 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 571476064. |
3 |
Incorrect |
114 ms |
4392 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136730926. |
4 |
Incorrect |
430 ms |
8464 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 870547617. |
5 |
Incorrect |
442 ms |
8292 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 976357712. |
6 |
Incorrect |
438 ms |
8304 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 579799611. |
7 |
Incorrect |
431 ms |
8192 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 781793354. |
8 |
Incorrect |
427 ms |
8340 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 499418120. |
9 |
Incorrect |
427 ms |
8220 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 277351906. |
10 |
Incorrect |
445 ms |
8228 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 274498057. |