Submission #1219705

#TimeUsernameProblemLanguageResultExecution timeMemory
1219705mariamtsagareliSquare or Rectangle? (NOI19_squarerect)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

bool am_i_square(int n,int q){
    int c=(n+1)/2;
    int a=1,b=n;
    while(a<b){
        int m=(a+b)/2;
        if(inside_shape(m,c)) b=m;
        else a=m+1;
    }
    int t=a;
    a=1; b=n;
    while(a<b){
        int m=(a+b+1)/2;
        if(inside_shape(m,c)) a=m;
        else b=m-1;
    }
    int d=a;
    int l=1,r=n;
    while(l<r){
        int m=(l+r)/2;
        if(inside_shape(c,m)) r=m;
        else l=m+1;
    }
    int e=l;
    l=1; r=n;
    while(l<r){
        int m=(l+r+1)/2;
        if(inside_shape(c,m)) l=m;
        else r=m-1;
    }
    int f=l;
    return d-t==f-e;
}

Compilation message (stderr)

squarerect.cpp: In function 'bool am_i_square(int, int)':
squarerect.cpp:9:12: error: 'inside_shape' was not declared in this scope
    9 |         if(inside_shape(m,c)) b=m;
      |            ^~~~~~~~~~~~
squarerect.cpp:16:12: error: 'inside_shape' was not declared in this scope
   16 |         if(inside_shape(m,c)) a=m;
      |            ^~~~~~~~~~~~
squarerect.cpp:23:12: error: 'inside_shape' was not declared in this scope
   23 |         if(inside_shape(c,m)) r=m;
      |            ^~~~~~~~~~~~
squarerect.cpp:30:12: error: 'inside_shape' was not declared in this scope
   30 |         if(inside_shape(c,m)) l=m;
      |            ^~~~~~~~~~~~