Submission #615945

#TimeUsernameProblemLanguageResultExecution timeMemory
615945Minindu2006Rectangles (IOI19_rect)C++14
50 / 100
5041 ms49392 KiB
#include "rect.h" #include <bits/stdc++.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 i1 = 1; i1 < n - 1; i1++) { for (int j1 = 1; j1 < m - 1; j1++) { for (int i2 = i1; i2 < n - 1; i2++) { if (a[i2][j1] >= a[i2][j1 - 1] || a[i2][j1] >= a[i1 - 1][j1]) break; int cont = 0; for (int j2 = j1; j2 < m - 1; j2++) { if (cont == 1) break; int can = 1; for (int x = i1; x <= i2; x++) { if (!can) break; for (int y = j1; y <= j2; y++) { if (!can) break; if (a[x][y] >= a[i1 - 1][y] || a[x][y] >= a[i2 + 1][y] || a[x][y] >= a[x][j1 - 1] || a[x][y] >= a[x][j2 + 1]) can = 0; if (can == 0) cont = (a[x][y] >= a[i1 - 1][y] || a[x][y] >= a[i2 + 1][y] || a[x][y] >= a[x][j1 - 1]); } } ans += can; } } } } 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...