#include <bits/stdc++.h>
using namespace std;
extern bool inside_shape(int,int);
bool am_i_square(int n,int q){
int i=0,x=-1,y=-1;
srand(74231);
while(i<q/2){
int a=rand()%n+1,b=rand()%n+1;
if(inside_shape(a,b)){x=a; y=b; break;}
i++;
}
if(x<0){
for(int a=1;a<=n && i<q/2;a+=5)
for(int b=1;b<=n && i<q/2;b+=5){
if(inside_shape(a,b)){x=a; y=b; break;}
i++;
}
}
if(x<0) x=y=1;
int l=x,r=x,u=y,d=y;
while(i<q && l>1){
if(inside_shape(l-1,y)) l--; else break;
i++;
}
while(i<q && r<n){
if(inside_shape(r+1,y)) r++; else break;
i++;
}
while(i<q && u>1){
if(inside_shape(x,u-1)) u--; else break;
i++;
}
while(i<q && d<n){
if(inside_shape(x,d+1)) d++; else break;
i++;
}
return (r-l)==(d-u);
}
# | 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... |