#include "squarerect.h"
#include <bits/stdc++.h>
using namespace std;
bool am_i_square(int n, int Q)
{
int x = -1;
int y = -1;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
if (inside_shape(i, j))
{
x = i;
y = j;
break;
}
}
}
int ax = x;
int i = x;
int j = n;
if (inside_shape(j, y))
{
i = n;
}
while (i + 1 < j)
{
int m = (i + j) / 2;
if (inside_shape(m, y))
{
i = m;
}
else
{
j = m;
}
}
ax = i;
int ay = y;
i = y;
j = n;
if (inside_shape(x, j))
{
i = n;
}
while (i + 1 < j)
{
int m = (i + j) / 2;
if (inside_shape(x, m))
{
i = m;
}
else
{
j = m;
}
}
ay = i;
return (abs(ax - x) == abs(ay - y));
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |