제출 #146612

#제출 시각아이디문제언어결과실행 시간메모리
146612BlagojceRectangles (IOI19_rect)C++14
37 / 100
2719 ms1048576 KiB
#include <bits/stdc++.h> #define fr(i, n, m) for(int i = (n); i < (m); i ++) #define pb push_back #define st first #define nd second #define pq priority_queue using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; ll const inf = 1e9; ll const mod = 1e9 + 7; ld const eps = 1e-9; #include "rect.h" long long count_rectangles(std::vector<std::vector<int> > a) { int n = a.size(); int m = a[0].size(); cin >> n >> m; /*a.resize(n); fr(i, 0, n){ a[i].resize(m); fr(j, 0, m)cin >>a[i][j]; }*/ int MAXr[n][m][m]; fr(i, 0, n){ fr(j, 0, m){ int MAX = 0; fr(o, j, m){ MAX = max(MAX, a[i][o]); MAXr[i][j][o] = MAX; } } } int MAXc[m][n][n]; fr(i, 0, m){ fr(j, 0 ,n){ int MAX = 0; fr(o, j, n){ MAX = max(MAX, a[o][i]); MAXc[i][j][o] = MAX; } } } bool ok = true; int CNT = 0; fr(i, 1, n){ fr(j, 1, m){ fr(ri, i, n - 1){ fr(cj, j, m - 1){ ok = true; fr(o, i, ri + 1){ if(MAXr[o][j][cj] >= min(a[o][cj + 1], a[o][j - 1])){ ok = false;; break; } } if(!ok) continue; fr(o, j, cj + 1){ if(MAXc[o][i][ri] >= min(a[i - 1][o], a[ri + 1][o])){ ok = false; break; } } if(ok)CNT ++; } } } } //cout << CNT << endl; return CNT; } /* int main() { count_rectangles({{1}}); return 0; }*/ /* 6 5 4 8 7 5 6 7 4 10 3 5 9 7 20 14 2 9 14 7 3 6 5 7 5 2 7 4 5 13 5 6 */
#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...