Submission #98602

# Submission time Handle Problem Language Result Execution time Memory
98602 2019-02-24T18:01:15 Z someone_aa popa (BOI18_popa) C++17
37 / 100
238 ms 512 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 = -1;
    for(int i=l;i<=r;i++) {
        if(query(l, i, i, r)) {
            index = i;
            break;
        }
    }

    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;
}*/
# Verdict Execution time Memory Grader output
1 Correct 59 ms 384 KB Output is correct
2 Correct 40 ms 512 KB Output is correct
3 Correct 17 ms 256 KB Output is correct
4 Correct 60 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 238 ms 376 KB too many queries
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 256 KB too many queries
2 Halted 0 ms 0 KB -