# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
116005 |
2019-06-10T07:10:31 Z |
minhcool |
Secret (JOI14_secret) |
C++17 |
|
640 ms |
4544 KB |
#include<bits/stdc++.h>
#include "secret.h"
using namespace std;
int ans[1001][11], n, b[1001];
int ask(int x, int y){
return Secret(x, y);
}
void build(){
for(int i = 1; i <= n; i++) ans[i][0] = b[i];
for(int i = 1; i < 10; i++){
int tmp = 1 << i;
for(int j = 1; j + tmp <= (n + 1); j++) ans[j][i] = ask(ans[j][i - 1], ans[j + (1 << (i - 1))][i - 1]);
}
}
void Init(int N, int A[]){
n = N;
for(int i = 1; i <= n; i++) b[i] = A[i - 1];
build();
}
int Query(int x, int y){
x++;
y++;
int tmp = x, answer = 0;
for(int i = 9; i >= 0; i--){
if(tmp + (1 << i) > (y + 1)) continue;
if(!answer) answer = ans[tmp][i];
else answer = ask(answer, ans[tmp][i]);
tmp += (1 << i);
}
return answer;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
167 ms |
2480 KB |
Output is partially correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 7 |
2 |
Partially correct |
168 ms |
2424 KB |
Output is partially correct - number of calls to Secret by Init = 3595, maximum number of calls to Secret by Query = 7 |
3 |
Partially correct |
169 ms |
2552 KB |
Output is partially correct - number of calls to Secret by Init = 3604, maximum number of calls to Secret by Query = 7 |
4 |
Partially correct |
524 ms |
4480 KB |
Output is partially correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 8 |
5 |
Partially correct |
533 ms |
4544 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
6 |
Partially correct |
514 ms |
4472 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 2 |
7 |
Partially correct |
557 ms |
4344 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
8 |
Partially correct |
547 ms |
4472 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 7 |
9 |
Partially correct |
640 ms |
4472 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
10 |
Partially correct |
542 ms |
4344 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 7 |