Submission #428329

#TimeUsernameProblemLanguageResultExecution timeMemory
428329MOUF_MAHMALATRectangles (IOI19_rect)C++14
0 / 100
5084 ms321004 KiB
#include "rect.h" #include<bits/stdc++.h> using namespace std; typedef int ll; ll dp[80][80][80][80][2],ans,a[80][80]; ll best(ll x,ll y,ll xx,ll yy,bool b) { if(x==xx&&y==yy) return a[x][y]; ll &r=dp[x][y][xx][yy][b]; if(r!=-1) return r; if(x!=xx) { if(b) return r=max(best(x,y,xx-1,yy,b),best(xx,y,xx,yy,b)); else return r=min(best(x,y,xx-1,yy,b),best(xx,y,xx,yy,b)); } else { if(b) return r=max(best(x,y,x,yy-1,b),a[x][yy]); else return r=min(best(x,y,x,yy-1,b),a[x][yy]); } } long long count_rectangles(vector<vector<int> > v) { for(ll i=0; i<v.size(); i++) for(ll j=0; j<v[i].size(); j++) a[i][j]=v[i][j]; memset(dp,-1,sizeof dp); for(ll i=1; i<v.size()-1; i++) for(ll j=1; j<v[i].size()-1; j++) for(ll o=i; o<v.size()-1; o++) for(ll p=j; p<v[i].size()-1; p++) if(best(i,j,o,p,1)<min(min(best(i-1,j,i-1,p,0),best(o+1,j,o+1,p,0)),min(best(i,j-1,o,j-1,0),best(i,p+1,o,p+1,0)))) ans++; }

Compilation message (stderr)

rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:30:18: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     for(ll i=0; i<v.size(); i++)
      |                 ~^~~~~~~~~
rect.cpp:31:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         for(ll j=0; j<v[i].size(); j++)
      |                     ~^~~~~~~~~~~~
rect.cpp:34:18: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(ll i=1; i<v.size()-1; i++)
      |                 ~^~~~~~~~~~~
rect.cpp:35:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for(ll j=1; j<v[i].size()-1; j++)
      |                     ~^~~~~~~~~~~~~~
rect.cpp:36:26: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |             for(ll o=i; o<v.size()-1; o++)
      |                         ~^~~~~~~~~~~
rect.cpp:37:30: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |                 for(ll p=j; p<v[i].size()-1; p++)
      |                             ~^~~~~~~~~~~~~~
rect.cpp:40:1: warning: no return statement in function returning non-void [-Wreturn-type]
   40 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...