# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
317340 | sebinkim | Square or Rectangle? (NOI19_squarerect) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "squarerect.h"
#include <bits/stdc++.h>
using namespace std;
bool am_i_square(int N)
{
auto ask = [&](int x, int y){
if(x < 1 || x > N || y < 1 || y > N) return false;
else return inside_shape(x, y);
};
int i, j, a, b, c, d;
a = b = N; c = d = 1;
for(i = 20; i < 100; i += 20){
for(j = 20; j < 100; j += 20){
if(ask(i, j)){
a = min(a, i); b = min(b, j);
c = max(c, i); d = max(d, j);
}
}
}
if(a == N){
for(i = 20; i <= 100; i += 20){
if(ask(i, N)){ a = i; break; }
if(ask(N, i)){ b = i; break; }
}
for(; a != N && ask(a + 1, b); a ++);
for(; b != N && ask(a, b + 1); b ++);