# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1280389 | jackofall718 | Square or Rectangle? (NOI19_squarerect) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#include <chrono>
#define ll long long int
#define endl '\n'
#define vn vector<ll>
#define vi vector<pair <ll,ll>>
using namespace std;
using namespace std::chrono;
const int MAX_N = 1e9 + 7;
#define pii pair<ll,ll>
const ll INF = 0x3f3f3f3f3f3f3f3f;
#define pb push_back
#define srt(vp) sort(vp.begin(), vp.end())
extern bool inside_shape (ll X, ll Y);//telling the code that this function exists
bool am_i_square(ll n , ll Q){
ll start_x=-1;
ll start_y=-1;
bool found = false;
for (int i=1;i<=n;i++){
for (int j=1;j<=n;j++){
if (inside_shape(i,j)){
found=true;
start_x=i;
start_y=j;
break;
}
if (found)break;
}
}
ll check = true;
while (start_x<=n && start_y<=n){
if (inside_shape(start_x+1,start_y+1)){
start_x++;
start_y++;
}
else{
check=false;
break;
}
}
return check;
}