답안 #959505

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
959505 2024-04-08T10:37:09 Z irmuun 비밀 (JOI14_secret) C++17
30 / 100
431 ms 8372 KB
#include<bits/stdc++.h>
#include "secret.h"

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

int n;
vector<pair<int,int>>v;
int val[1005][1005],a[1005];
void build(int l,int r){
    if(l==r){
        val[l][r]=a[l];
        return;
    }
    int mid=(l+r)/2;
    build(l,mid);
    build(mid+1,r);
    val[l][r]=Secret(val[l][mid],val[mid+1][r]);
}
void ask(int l,int r,int L,int R){
    if(l>r||R<l||r<L) return;
    if(L<=l&&r<=R){
        v.pb({l,r});
        return;
    }
    int mid=(l+r)/2;
    ask(l,mid,L,R);
    ask(mid+1,r,L,R);
}
void Init(int N,int A[]){
    n=N;
    for(int i=0;i<n;i++){
        a[i]=A[i];
    }
    build(0,n-1);
}
int Query(int l,int r){
    v.clear();
    ask(0,n-1,l,r);
    int ans=val[v[0].ff][v[0].ss];
    for(int i=1;i<v.size();i++){
        ans=Secret(ans,val[v[i].ff][v[i].ss]);
    }
    return ans;
}

Compilation message

secret.cpp: In function 'int Query(int, int)':
secret.cpp:47:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |     for(int i=1;i<v.size();i++){
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 136 ms 6740 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 141 ms 6832 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 145 ms 6740 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 427 ms 8300 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 397 ms 8272 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 399 ms 8372 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 431 ms 8296 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 413 ms 8272 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 414 ms 8276 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 422 ms 8364 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16