답안 #98601

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
98601 2019-02-24T17:58:09 Z someone_aa popa (BOI18_popa) C++17
0 / 100
20 ms 556 KB
#include <bits/stdc++.h>
#include "popa.h"
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn = 1100;

/*int query(int a, int b, int c, int d) {
    cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
    int answer;
    cin>>answer;
    return answer;
}*/

int n;
int parent[maxn];
int li[maxn], ri[maxn];
int solvef(int l, int r) {
    if(l > r) return -1;
    else if(l == r) return l;

    int index = r;
    for(int cekor = n/2; cekor>0;cekor/=2) {
        while(index-cekor>=l && query(l, index-cekor, index-cekor, r)) index-=cekor;
    }

    li[index] = solvef(l, index-1);
    ri[index] = solvef(index+1, r);

    //cout<<"["<<l<<", "<<r<<"] -> "<<index<<"\n";

    return index;
}
// solve function
int solve(int N, int *l , int *r) {
    for(int i=0;i<N;i++) {
        li[i] = ri[i] = -1;
    }
    n = N;
    int x = solvef(0, n-1);
    for(int i=0;i<n;i++) {
        l[i] = li[i];
        r[i] = ri[i];
    }
    return x;
}

/*int main() {
    int a[6], b[6];
    cout<<solve(6, a, b);
    return 0;
}*/
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 20 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 15 ms 332 KB too many queries
2 Halted 0 ms 0 KB -