답안 #1056341

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1056341 2024-08-13T08:55:57 Z Minbaev 비밀 (JOI14_secret) C++17
30 / 100
311 ms 4436 KB
#include "secret.h"

using namespace std;

const int nmax = 1000 + 5;
 
using namespace std;
 
int n, a[nmax];
int tree[nmax << 2];
 
void build(int id, int l, int r){
    if(l == r){
        tree[id] = a[l];
        return;
    }
    int mid = r + l >> 1;
    build(id << 1, l, mid);
    build(id << 1| 1, mid + 1, r);
    tree[id] = Secret(tree[id << 1], tree[id << 1 | 1]);
}
int get(int id, int l, int r, int u, int v){
    if(l >= u && r <= v) return tree[id];
    int mid = r + l >> 1;
    if(mid< u) return get(id << 1 | 1, mid + 1, r, u, v);
    if(mid + 1 > v) return get(id << 1, l, mid, u, v);
    return Secret(get(id << 1, l, mid, u, v), get(id << 1 | 1, mid + 1, r, u, v));
}
void Init(int N, int A[]){
    n = N;
    for(int i = 0; i < n; ++i) a[i] = A[i];
    build(1, 0, n - 1);
 
}
int Query(int l, int r){
    return get(1, 0, n - 1, l, r);
}

Compilation message

secret.cpp: In function 'void build(int, int, int)':
secret.cpp:17:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   17 |     int mid = r + l >> 1;
      |               ~~^~~
secret.cpp: In function 'int get(int, int, int, int, int)':
secret.cpp:24:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   24 |     int mid = r + l >> 1;
      |               ~~^~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 101 ms 3536 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 94 ms 3912 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 93 ms 3668 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 283 ms 4240 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 281 ms 4412 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 266 ms 4344 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 311 ms 4176 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 293 ms 4180 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 291 ms 4352 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 293 ms 4436 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16