# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
995256 |
2024-06-08T17:44:00 Z |
yeediot |
Secret (JOI14_secret) |
C++17 |
|
378 ms |
4688 KB |
#include<bits/stdc++.h>
#include "secret.h"
//#include "/Users/iantsai/Downloads/secret/grader.cpp"
using namespace std;
const int mxn = 1005;
int seg[4*mxn], a[mxn], n;
void build(int l,int r,int id){
if(l == r){
seg[id] = a[l];
return;
}
int mm = l+r>>1;
build(l, mm, id*2);
build(mm+1, r, id*2+1);
seg[id] = Secret(seg[id*2],seg[id*2+1]);
}
int query(int l,int r, int id,int ql,int qr){
if(ql <= l and r <= qr){
return seg[id];
}
int mm=l+r>>1;
if(qr<=mm){
return query(l,mm,id*2,ql,qr);
}
else if(ql>mm){
return query(mm+1,r,id*2+1,ql,qr);
}
else{
return Secret(query(l,mm,id*2,ql,mm),query(mm+1,r,id*2+1,mm+1,qr));
}
}
void Init(int N, int b[]){
n = N;
for(int i=1;i<=n;i++){
a[i] = b[i-1];
}
build(1,n,1);
}
int Query(int l,int r){
l++;
r++;
return query(1,n,1,l,r);
}
Compilation message
secret.cpp: In function 'void build(int, int, int)':
secret.cpp:12:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
12 | int mm = l+r>>1;
| ~^~
secret.cpp: In function 'int query(int, int, int, int, int)':
secret.cpp:21:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
21 | int mm=l+r>>1;
| ~^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
115 ms |
2652 KB |
Output is partially correct - number of calls to Secret by Init = 510, maximum number of calls to Secret by Query = 13 |
2 |
Partially correct |
111 ms |
2812 KB |
Output is partially correct - number of calls to Secret by Init = 511, maximum number of calls to Secret by Query = 14 |
3 |
Partially correct |
118 ms |
2652 KB |
Output is partially correct - number of calls to Secret by Init = 512, maximum number of calls to Secret by Query = 15 |
4 |
Partially correct |
342 ms |
4504 KB |
Output is partially correct - number of calls to Secret by Init = 998, maximum number of calls to Secret by Query = 15 |
5 |
Partially correct |
378 ms |
4324 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 15 |
6 |
Partially correct |
314 ms |
4380 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 4 |
7 |
Partially correct |
349 ms |
4284 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |
8 |
Partially correct |
358 ms |
4688 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |
9 |
Partially correct |
352 ms |
4436 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |
10 |
Partially correct |
365 ms |
4352 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |