제출 #242071

#제출 시각아이디문제언어결과실행 시간메모리
242071AmineWeslatiSquare or Rectangle? (NOI19_squarerect)C++14
컴파일 에러
0 ms0 KiB
//Never stop trying #pragma GCC optimize("O3") #include <bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; //s.order_of_key(), *s.find_by_order() using namespace std; #define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) typedef string str; typedef long long ll; #define int ll typedef double db; typedef long double ld; typedef pair<int,int> pi; #define fi first #define se second typedef vector<int> vi; typedef vector<ld> vd; typedef vector<str> vs; typedef vector<pi> vpi; #define pb push_back #define eb emplace_back #define pf push_front #define lb lower_bound #define ub upper_bound #define sz(x) (int)x.size() #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) #define endl "\n" const int MOD = 1e9+7; //998244353 const ll INF = 1e18; const int nx[4]={0,0,1,-1}, ny[4]={1,-1,0,0}; //right left down up //bool inside_shape(int x, int y){} bool am_i_square(int N, int Q){ int mnx=INF,mny=INF,mxx=-1,mxy=-1; for(int i=20; i<=80; i+=20) for(int j=20; j<=80; j+=20) if(inside_shape(i,j)){ mnx=min(mnx,i); mny=min(mny,j); mxx=max(mxx,i); mxy=max(mxy,j); } if(mxx!=-1){ int l=mnx-20+1,r=mnx; while(l<r){ int m=(l+r)/2; if(!inside_shape(m,mny)) l=m+1; else r=m; } mnx=l; l=mny-20+1;r=mny; while(l<r){ int m=(l+r)/2; if(!inside_shape(mnx,m)) l=m+1; else r=m; } mny=l; l=mxx; r=mxx+20-1; while(l<r){ int m=(l+r)/2; if(!inside_shape(m,mny)) l=m+1; else r=m; } mxx=l; if(!inside_shape(mnx,mny+mxx-mnx)) return false; if(inside_shape(mnx,mny+mxx-mnx+1)) return false; return true; } else{ int nb=0; int x,y; for(int i=20; i<=100; i+=20) if(inside_shape(i,100)){ nb++; x=i; y=100; } if(nb>1) return false; if(nb){ int l=x-20+1,r=x; while(l<x){ int m=(l+r)/2; if(!inside_shape(m,y)) l=m+1; else r=m; } x=l; if(!inside_shape(x+19,y)) return false; if(inside_shape(x+20,y)) return false; return true; } for(int j=20; j<=80; j++) if(inside_shape(100,j)){ nb++; x=100; y=j; } if(nb>1) return false; int l=y-20+1,r=y; while(l<x){ int m=(l+r)/2; if(!inside_shape(x,m)) l=m+1; else r=m; } y=l; if(!inside_shape(x,y+19)) return false; if(inside_shape(x,y+20)) return false; return true; } } /*int32_t main(){ boost; return 0; }*/

컴파일 시 표준 에러 (stderr) 메시지

squarerect.cpp: In function 'bool am_i_square(ll, ll)':
squarerect.cpp:51:63: error: 'inside_shape' was not declared in this scope
    for(int i=20; i<=80; i+=20) for(int j=20; j<=80; j+=20) if(inside_shape(i,j)){
                                                               ^~~~~~~~~~~~
squarerect.cpp:51:63: note: suggested alternative: 'initstate'
    for(int i=20; i<=80; i+=20) for(int j=20; j<=80; j+=20) if(inside_shape(i,j)){
                                                               ^~~~~~~~~~~~
                                                               initstate
squarerect.cpp:58:14: error: 'inside_shape' was not declared in this scope
          if(!inside_shape(m,mny)) l=m+1;
              ^~~~~~~~~~~~
squarerect.cpp:58:14: note: suggested alternative: 'initstate'
          if(!inside_shape(m,mny)) l=m+1;
              ^~~~~~~~~~~~
              initstate
squarerect.cpp:65:14: error: 'inside_shape' was not declared in this scope
          if(!inside_shape(mnx,m)) l=m+1;
              ^~~~~~~~~~~~
squarerect.cpp:65:14: note: suggested alternative: 'initstate'
          if(!inside_shape(mnx,m)) l=m+1;
              ^~~~~~~~~~~~
              initstate
squarerect.cpp:72:14: error: 'inside_shape' was not declared in this scope
          if(!inside_shape(m,mny)) l=m+1;
              ^~~~~~~~~~~~
squarerect.cpp:72:14: note: suggested alternative: 'initstate'
          if(!inside_shape(m,mny)) l=m+1;
              ^~~~~~~~~~~~
              initstate
squarerect.cpp:76:11: error: 'inside_shape' was not declared in this scope
       if(!inside_shape(mnx,mny+mxx-mnx)) return false;
           ^~~~~~~~~~~~
squarerect.cpp:76:11: note: suggested alternative: 'initstate'
       if(!inside_shape(mnx,mny+mxx-mnx)) return false;
           ^~~~~~~~~~~~
           initstate
squarerect.cpp:77:10: error: 'inside_shape' was not declared in this scope
       if(inside_shape(mnx,mny+mxx-mnx+1)) return false;
          ^~~~~~~~~~~~
squarerect.cpp:77:10: note: suggested alternative: 'initstate'
       if(inside_shape(mnx,mny+mxx-mnx+1)) return false;
          ^~~~~~~~~~~~
          initstate
squarerect.cpp:83:39: error: 'inside_shape' was not declared in this scope
       for(int i=20; i<=100; i+=20) if(inside_shape(i,100)){
                                       ^~~~~~~~~~~~
squarerect.cpp:83:39: note: suggested alternative: 'initstate'
       for(int i=20; i<=100; i+=20) if(inside_shape(i,100)){
                                       ^~~~~~~~~~~~
                                       initstate
squarerect.cpp:92:17: error: 'inside_shape' was not declared in this scope
             if(!inside_shape(m,y)) l=m+1;
                 ^~~~~~~~~~~~
squarerect.cpp:92:17: note: suggested alternative: 'initstate'
             if(!inside_shape(m,y)) l=m+1;
                 ^~~~~~~~~~~~
                 initstate
squarerect.cpp:96:14: error: 'inside_shape' was not declared in this scope
          if(!inside_shape(x+19,y)) return false;
              ^~~~~~~~~~~~
squarerect.cpp:96:14: note: suggested alternative: 'initstate'
          if(!inside_shape(x+19,y)) return false;
              ^~~~~~~~~~~~
              initstate
squarerect.cpp:97:13: error: 'inside_shape' was not declared in this scope
          if(inside_shape(x+20,y)) return false;
             ^~~~~~~~~~~~
squarerect.cpp:97:13: note: suggested alternative: 'initstate'
          if(inside_shape(x+20,y)) return false;
             ^~~~~~~~~~~~
             initstate
squarerect.cpp:100:36: error: 'inside_shape' was not declared in this scope
       for(int j=20; j<=80; j++) if(inside_shape(100,j)){
                                    ^~~~~~~~~~~~
squarerect.cpp:100:36: note: suggested alternative: 'initstate'
       for(int j=20; j<=80; j++) if(inside_shape(100,j)){
                                    ^~~~~~~~~~~~
                                    initstate
squarerect.cpp:109:14: error: 'inside_shape' was not declared in this scope
          if(!inside_shape(x,m)) l=m+1;
              ^~~~~~~~~~~~
squarerect.cpp:109:14: note: suggested alternative: 'initstate'
          if(!inside_shape(x,m)) l=m+1;
              ^~~~~~~~~~~~
              initstate
squarerect.cpp:113:11: error: 'inside_shape' was not declared in this scope
       if(!inside_shape(x,y+19)) return false;
           ^~~~~~~~~~~~
squarerect.cpp:113:11: note: suggested alternative: 'initstate'
       if(!inside_shape(x,y+19)) return false;
           ^~~~~~~~~~~~
           initstate
squarerect.cpp:114:10: error: 'inside_shape' was not declared in this scope
       if(inside_shape(x,y+20)) return false;
          ^~~~~~~~~~~~
squarerect.cpp:114:10: note: suggested alternative: 'initstate'
       if(inside_shape(x,y+20)) return false;
          ^~~~~~~~~~~~
          initstate