Submission #66505

# Submission time Handle Problem Language Result Execution time Memory
66505 2018-08-11T06:53:23 Z Bruteforceman popa (BOI18_popa) C++11
0 / 100
207 ms 404 KB
#include <bits/stdc++.h>
#include "popa.h"
using namespace std;
int par[1111];

int solve(int N, int* left, int* right) {
	int cur = 0;
	int root = 0;
	// memset(left, -1, sizeof left);
	// memset(right, -1, sizeof right);
	memset(par, -1, sizeof par);
	for(int i = 1; i < N; i++) {
		while(cur != -1) {
			if(query(cur, i, cur, cur) == true) {
				if(right[cur] != -1){
					left[i] = right[cur];
					par[right[cur]] = i; 
				}
				right[cur] = i;
				par[i] = cur;
				break;
			}
			cur = par[cur];
		}
		if(cur == -1) {
			par[root] = i;
			left[i] = root;
			root = i;
		}
		cur = i;
	}	
	return root;
}
# Verdict Execution time Memory Grader output
1 Incorrect 81 ms 248 KB too many queries
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 207 ms 348 KB too many queries
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 404 KB too many queries
2 Halted 0 ms 0 KB -