#include <bits/stdc++.h>
using namespace std;
extern bool inside_shape(int x,int y);
bool am_i_square(int n,int q){
int c=(n+1)/2;
int a=1,b=n,m;
while(a<b){
m=(a+b)/2;
if(inside_shape(m,c)) b=m;
else a=m+1;
}
int p=a;
a=1; b=n;
while(a<b){
m=(a+b+1)/2;
if(inside_shape(m,c)) a=m;
else b=m-1;
}
int r=a;
int d=1,e=n;
while(d<e){
m=(d+e)/2;
if(inside_shape(c,m)) e=m;
else d=m+1;
}
int s=d;
d=1; e=n;
while(d<e){
m=(d+e+1)/2;
if(inside_shape(c,m)) d=m;
else e=m-1;
}
int t=d;
return (r-p)==(t-s);
}
# | 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... |