Submission #805184

#TimeUsernameProblemLanguageResultExecution timeMemory
805184farukRectangles (IOI19_rect)C++17
37 / 100
2559 ms1048576 KiB
#include "rect.h" #include <bits/stdc++.h> #define mp make_pair #define all(a) a.begin(), a.end() using namespace std; typedef long long ll; typedef pair<int, int> pii; int cumsum(int l, int r, vector<int>& a) { return a[r] - a[l - 1]; } int n, m; long long count_rectangles(std::vector<std::vector<int> > a) { n = a.size(), m = a[0].size(); vector<vector<vector<int> > > colsum(n, vector<vector<int> >(n, vector<int>(m))); for (int l = 1; l < n - 1; l++) { for (int r = l; r < n - 1; r++) { for (int i = 1; i < m - 1; i++) { int ok = 0; for (int j = l; j <= r; j++) { if (a[j][i] >= a[l - 1][i] || a[j][i] >= a[r + 1][i]) ok = 1; } colsum[l][r][i] += ok + colsum[l][r][i - 1]; } } } vector<vector<vector<int> > > rowsum(m, vector<vector<int> >(m, vector<int>(n))); for (int l = 1; l < m - 1; l++) { for (int r = l; r < m - 1; r++) { for (int i = 1; i < n - 1; i++) { int ok = 0; for (int j = l; j <= r; j++) if (a[i][j] >= a[i][l - 1] || a[i][j] >= a[i][r + 1]) ok = 1; rowsum[l][r][i] += ok + rowsum[l][r][i - 1]; } } } int cnt = 0; for (int i = 1; i < n - 1; i++) { for (int j = i; j < n - 1; j++) { for (int k = 1; k < m - 1; k++) { for (int l = k; l < m - 1; l++) { if (cumsum(k, l, colsum[i][j]) == 0 and cumsum(i, j, rowsum[k][l]) == 0) { cout; cnt++; } } } } } return cnt; }

Compilation message (stderr)

rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:51:7: warning: statement has no effect [-Wunused-value]
   51 |       cout;
      |       ^~~~
#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...