Submission #380844

# Submission time Handle Problem Language Result Execution time Memory
380844 2021-03-23T09:40:48 Z VodkaInTheJar popa (BOI18_popa) C++14
0 / 100
168 ms 1420 KB
#include <bits/stdc++.h>
#include "popa.h"

using namespace std;

int attach(int root, int ver, int *left, int *right)
{
	if (root == -1)
	return ver;
	
	if (query(root, ver, ver, ver))
	{
		left[ver] = root;
		return ver; 
	}
	
	right[root] = attach(right[root], ver, left, right);
	return root; 
}

int solve(int n, int *left, int *right)
{
	left[0] = right[0] = -1;
	int root = 0;
	for (int i = 1; i < n; i++)
	root = attach(root, i, left, right);
	
	return root; 
}
# Verdict Execution time Memory Grader output
1 Incorrect 68 ms 788 KB too many queries
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 168 ms 1420 KB too many queries
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 492 KB too many queries
2 Halted 0 ms 0 KB -