Submission #1276899

#TimeUsernameProblemLanguageResultExecution timeMemory
1276899vibeduckSquare or Rectangle? (NOI19_squarerect)C++20
0 / 100
1 ms340 KiB
#include "squarerect.h"
#include <bits/stdc++.h>
using namespace std;

bool am_i_square(int N, int Q) {
	int i = -1, j = -1;
	int k = (N + 4)/5;
	cout << "K " << k << '\n';
	for (int a = k; a <= N-k; a += k) {
		for (int b = k; b <= N - k; b += k) {
			if (inside_shape(a, b)) {
				i = a; j = b;
				break;
			}
		}
		if (i != -1) break;
	}

	cout << "i: " << i << '\n';
	cout << "j: " << j << '\n';
	assert(i != -1);
	assert(j != -1);

	for (int b = 20; b >= 0; b--) {
		if (i + (1 << b) >= N) continue;
		if (inside_shape(i + (1 << b), j)) i += (1 << b);
	}

	for (int b = 20; b >= 0; b--) {
		if (j + (1 << b) >= N) continue;
		if (inside_shape(i, j + (1 << b))) j += (1 << b);
	}

	cout << "bottomright:\n";
	cout << "i: " << i << '\n';
	cout << "j: " << j << '\n';

	for (int b = 20; b >= 0; b--) {
		if (min(i, j) - (1 << b) < 0) continue;
		if (inside_shape(i - (1 << b), j - (1 << b))) {
			i -= (1 << b);
			j -= (1 << b);
		}
	}

	cout << "toplefticouldfind:\n";
	cout << "i: " << i << '\n';
	cout << "j: " << j << '\n';

	int b1 = 0; if (i > 0) b1 = inside_shape(i - 1, j);
	int b2 = 0; if (j > 0) b2 = inside_shape(i, j - 1);

	cout << b1 << " " << b2 << " are bools\n";

	assert(!(b1 && b2));

	return !(b1 ^ b2);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...