Submission #98593

# Submission time Handle Problem Language Result Execution time Memory
98593 2019-02-24T17:07:13 Z someone_aa popa (BOI18_popa) C++17
0 / 100
60 ms 612 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 parent[maxn];
int li[maxn], ri[maxn];
int solvef(int l, int r) {
    if(l > r) return -1;
    if(l == r) return l;

    int lb = l, rb = r;
    int index = r;
    while(lb < rb) {
        int mid = (lb + rb) / 2;
        if(query(l, mid, mid, r)) {
            rb = mid;
            index = min(index, mid);
        }
        else {
            lb = mid+1;
        }
    }



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

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

    for(int i=0;i<n;i++) {
        l[i] = li[i];
        r[i] = ri[i];
        //cout<<i<<": "<<l[i]<<" "<<r[i]<<"\n";
    }

    return x;
}

/*int main() {
    int a[6], b[6];
    cout<<solve(6, a, b);
    return 0;
}*/
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 60 ms 612 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 336 KB too many queries
2 Halted 0 ms 0 KB -