Submission #61934

# Submission time Handle Problem Language Result Execution time Memory
61934 2018-07-27T05:47:33 Z alex(#2140) popa (BOI18_popa) C++11
37 / 100
306 ms 524 KB
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <iterator>

#include "popa.h"

using namespace std;

int chi[1010][2];

int f(int l, int r)
{
    if(r < l)
        return -1;

    for(int i = l; i <= r; i++)
    {
        if(query(l, r, i, i))
        {
            chi[i][0] = f(l, i - 1);
            chi[i][1] = f(i + 1, r);
            return i;
        }
    }

    assert(false);
}

int solve(int n, int *l, int *r)
{
    int x = f(0, n - 1);
    for(int i = 0; i < n; i++)
    {
        l[i] = chi[i][0];
        r[i] = chi[i][1];
    }
    return x;
}
# Verdict Execution time Memory Grader output
1 Correct 71 ms 248 KB Output is correct
2 Correct 95 ms 308 KB Output is correct
3 Correct 33 ms 512 KB Output is correct
4 Correct 48 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 306 ms 524 KB too many queries
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 524 KB too many queries
2 Halted 0 ms 0 KB -