Submission #1219700

#TimeUsernameProblemLanguageResultExecution timeMemory
1219700mariamtsagareliSquare or Rectangle? (NOI19_squarerect)C++20
14 / 100
0 ms328 KiB
#include <bits/stdc++.h>
using namespace std;

// Keep the external function name as expected by the grader
extern bool inside_shape(int b, int c);

// Also restore the function name to what the grader expects
bool am_i_square(int e, int f){
    int g,h,i,j;
    int k=max(1,e/10);
    for(g=1;g<=e;g+=k){
        for(h=1;h<=e;h+=k){
            if(inside_shape(g,h)){
                i=g;
                j=h;
                goto l;
            }
        }
    }
l:;
    int m,n,o;
    m=1;n=i;
    while(m<n){
        o=(m+n)/2;
        if(inside_shape(o,j)) n=o;
        else m=o+1;
    }
    int p=m;
    m=i;n=e;
    while(m<n){
        o=(m+n+1)/2;
        if(inside_shape(o,j)) m=o;
        else n=o-1;
    }
    int q=m;
    m=1;n=j;
    while(m<n){
        o=(m+n)/2;
        if(inside_shape(i,o)) n=o;
        else m=o+1;
    }
    int r=m;
    m=j;n=e;
    while(m<n){
        o=(m+n+1)/2;
        if(inside_shape(i,o)) m=o;
        else n=o-1;
    }
    int s=m;
    return (q-p)==(s-r);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...