답안 #995242

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
995242 2024-06-08T17:28:03 Z yeediot 비밀 (JOI14_secret) C++17
0 / 100
305 ms 4496 KB
#include<bits/stdc++.h>
#include "secret.h"
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){
    return query(1,n,1,l,r);
}

Compilation message

secret.cpp: In function 'void build(int, int, int)':
secret.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   11 |     int mm = l+r>>1;
      |              ~^~
secret.cpp: In function 'int query(int, int, int, int, int)':
secret.cpp:20:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   20 |     int mm=l+r>>1;
      |            ~^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 77 ms 2812 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 22166791.
2 Incorrect 77 ms 2648 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 306225408.
3 Incorrect 77 ms 2652 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 629483540.
4 Incorrect 305 ms 4496 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 34079308.
5 Incorrect 296 ms 4432 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 542818560.
6 Incorrect 299 ms 4432 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 579799611.
7 Incorrect 304 ms 4348 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 772352096.
8 Incorrect 299 ms 4344 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 290455552.
9 Incorrect 303 ms 4352 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 164632041.
10 Incorrect 300 ms 4440 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 872638089.