답안 #1086677

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1086677 2024-09-11T08:59:46 Z LeonidCuk 비밀 (JOI14_secret) C++17
0 / 100
340 ms 8984 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
vector<int>v,dp[20];
void daq(int i,int l,int r)
{
    if(l==r)
    {
        dp[i][l]=v[l];
        return;
    }
    int m=(l+r)/2;
    dp[i][m]=v[m];
    for(int j=m-1;j>=l;j++)
    {
        dp[i][j]=Secret(dp[i][j+1],v[j]);
    }
    dp[i][m+1]=v[m+1];
    for(int j=m+2;j<=r;j++)
    {
        dp[i][j]=Secret(dp[i][j-1],v[j]);
    }
    daq(i+1,l,m);
    daq(i+1,m+1,r);
}
int najdi(int i,int l,int r)
{
    if(l==r)
    {
        return v[l];
    }
    int m=(l+r)/2;
    if(l<=m&&m<r)
    {
        return Secret(dp[i][l],dp[i][r]);
    }
    else if(r<=m)
    {
        return najdi(i+1,l,m);
    }
    else
    {
        return najdi(i+1,m+1,r);
    }
}
void Init(int N,int A[])
{
    for(int i=0;i<N;i++)
    {
        v.push_back(A[i]);
    }
    for(int i=0;i<20;i++)
    {
        dp[i].resize(N);
    }
    daq(0,0,N-1);
}
int Query(int l,int r)
{
      return najdi(0,l,r);
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 83 ms 4692 KB Execution killed with signal 11
2 Runtime error 82 ms 4684 KB Execution killed with signal 11
3 Runtime error 80 ms 4816 KB Execution killed with signal 11
4 Runtime error 319 ms 8788 KB Execution killed with signal 11
5 Runtime error 340 ms 8984 KB Execution killed with signal 11
6 Runtime error 323 ms 8784 KB Execution killed with signal 11
7 Runtime error 313 ms 8796 KB Execution killed with signal 11
8 Runtime error 313 ms 8788 KB Execution killed with signal 11
9 Runtime error 316 ms 8760 KB Execution killed with signal 11
10 Runtime error 318 ms 8788 KB Execution killed with signal 11