제출 #295082

#제출 시각아이디문제언어결과실행 시간메모리
295082theStaticMindRectangles (IOI19_rect)C++14
0 / 100
37 ms3072 KiB
#include <bits/stdc++.h> #include "rect.h" using namespace std; bool h[80][80][80][80]; bool v[80][80][80][80]; long long count_rectangles(std::vector<std::vector<int> > a) { int n = a.size(); int m = a[0].size(); for(int i = 0; i < n; i++){ for(int j = 1; j < m - 1; j++){ int mx = a[i][j]; for(int k = j; k < m - 1; k++){ mx = max(mx, a[i][k]); h[i][i][j][k] = (mx < a[i][k + 1]); } mx = a[i][j]; for(int k = j; k > 0; k--){ mx = max(mx, a[i][k]); h[i][i][k][j] = (mx < a[i][k - 1]); } } } for(int i = 0; i < m; i++){ for(int j = 1; j < n - 1; j++){ int mx = a[j][i]; for(int k = j; k < n - 1; k++){ mx = max(mx, a[k][i]); v[i][i][j][k] = (mx < a[k + 1][i]); } mx = a[j][i]; for(int k = j; k > 0; k--){ mx = max(mx, a[i][k]); v[i][i][k][j] = (mx < a[k - 1][i]); } } } for(int i = 1; i < m - 1; i++){ for(int j = i; j < m - 1; j++){ for(int k = 1; k < n - 1; k++){ for(int l = k + 1; l < n - 1; l++){ h[k][l][i][j] = h[k][l - 1][i][j] & h[l][l][i][j]; } } } } 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 + 1; l < m - 1; l++){ h[k][l][i][j] = h[k][l - 1][i][j] & h[l][l][i][j]; } } } } long long cnt = 0; for(int i = 1; i < m - 1; i++){ for(int j = i; j < m - 1; j++){ for(int k = 1; k < n - 1; k++){ for(int l = k; l < n - 1; l++){ if(h[k][l][i][j] & v[i][j][k][l]) cnt++; } } } } return cnt; }
#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...