Submission #393485

#TimeUsernameProblemLanguageResultExecution timeMemory
393485AmineTrabelsiRectangles (IOI19_rect)C++14
25 / 100
5066 ms28296 KiB
#include "rect.h" #include <bits/stdc++.h> using namespace std; long long count_rectangles(vector<vector<int>> a) { // naive int n = a.size(),m = a[0].size(); long long res = 0; auto is_valid = [&](int x,int b,int c,int d){ for(int i=x;i<=c;i++){ for(int j=b;j<=d;j++){ if(a[i][j] >= min({a[x-1][j],a[c+1][j],a[i][b-1],a[i][d+1]}))return false; } } return true; }; for(int i=1;i+1<n;i++){ for(int j=1;j+1<m;j++){ for(int k=1;k<=i;k++){ for(int l=1;l<=j;l++){ if(is_valid(k,l,i,j)){ res ++; } } } } } return res; }
#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...