Submission #618466

#TimeUsernameProblemLanguageResultExecution timeMemory
618466chirathnirodhaRectangles (IOI19_rect)C++17
0 / 100
1 ms340 KiB
#include "rect.h" #include<bits/stdc++.h> using namespace std; long long count_rectangles(vector<vector<int> > a) { int n=a.size(); int m=a[0].size(); int ans=0; for(int i=0;i<n;i++){ for(int j=i+2;j<n;j++){ int l=0,r=2; int curmax[n]; while(l<n && r<n){ int maxi=0; bool ok=true; for(int k=i+1;k<=j-1;k++){ if(a[k][r-1]>a[i][r-1] || a[k][r-1]>a[j][r-1]){ok=false;break;} curmax[k]=max(curmax[k],a[k][r-1]); if(curmax[k]>a[k][l] || curmax[k]>a[k][r]){ok=false;break;} } if(!ok)l=r-1; else ans++; r++; } } } return ans; }

Compilation message (stderr)

rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:14:9: warning: unused variable 'maxi' [-Wunused-variable]
   14 |     int maxi=0;
      |         ^~~~
rect.cpp:7:6: warning: unused variable 'm' [-Wunused-variable]
    7 |  int m=a[0].size();
      |      ^
#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...