Submission #517593

#TimeUsernameProblemLanguageResultExecution timeMemory
517593bebecanvasSquare or Rectangle? (NOI19_squarerect)C++14
0 / 100
1 ms292 KiB
#include "squarerect.h" #include <bits/stdc++.h> using namespace std; bool am_i_square(int N, int Q) { int lol= N/25; int x=0; int y=0; bool found= false; for(int i=1; i<=N; i+=lol){ for(int j=1; j<=N; j+=lol){ if(inside_shape(i, j)){ x= i; y= j; found= true; break; } } if(found){break;} } int s= 1; int e= x; while(s<=e){ int mid= s+(e-s)/2; if(inside_shape(mid, y)){e= mid;} else{s= mid;} } x= e; s= 1; e= y; while(s<=e){ int mid= s+(e-s)/2; if(inside_shape(x, mid)){e= mid;} else{s= mid;} } y= e; int ss= x; int ee= N; while(ss<=ee){ int mid= ss+(ee-ss)/2; if(inside_shape(mid, y)){ss= mid;} else{ee=mid;} } int d1= ss-x; ss= y; ee= N; while(ss<=ee){ int mid= ss+(ee-ss)/2; if(inside_shape(x, mid)){ss= mid;} else{ee=mid;} } int d2= ss-y; if(d1==d2){return true;} else{return false;} }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...