Submission #296648

#TimeUsernameProblemLanguageResultExecution timeMemory
296648zoooma13Rectangles (IOI19_rect)C++14
10 / 100
5075 ms27256 KiB
#include "bits/stdc++.h"
#include "rect.h"
using namespace std;

long long count_rectangles(vector<vector<int>> a){
    int n = a.size() ,m = a[0].size();

    long long ans = 0;
    for(int i=0; i+2<n; i++){
        for(int l=0; l<m; l++)
        for(int r=l+2; r<m; r++)
        {
            bool bad = false ,ok;
            for(int k=i+1; k+1<n; k++){
                ok = true;
                for(int j=l+1; j+1<=r; j++){
                    ok &= (a[k][j] < a[k+1][j]);
                    if(a[k][j] >= a[i][j] || a[k][j] >= a[k][l] || a[k][j] >= a[k][r]){
                        bad = true;
                        break;
                    }
                }
                if(bad) break;

                //if(ok)printf("[%d ,%d] to [%d ,%d]\n",i+1,l+1,k,r-1);
                ans += ok;
            }
        }
    }

    return ans;
}
#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...