제출 #832138

#제출 시각아이디문제언어결과실행 시간메모리
832138maomao90Rectangles (IOI19_rect)C++17
49 / 100
3443 ms687484 KiB
// I can do all things through Christ who strengthens me // Philippians 4:13 #include "rect.h" #include "bits/stdc++.h" using namespace std; #define REP(i, j, k) for (int i = j; i < (k); i++) #define RREP(i, j, k) for (int i = j; i >= (k); i--) template <class T> inline bool mnto(T &a, const T b) {return a > b ? a = b, 1 : 0;} template <class T> inline bool mxto(T &a, const T b) {return a < b ? a = b, 1 : 0;} typedef long long ll; typedef long double ld; #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; #define SZ(x) (int) x.size() #define ALL(x) x.begin(), x.end() #define pb push_back typedef vector<int> vi; typedef vector<ii> vii; typedef vector<ll> vll; typedef tuple<int, int, int> iii; typedef vector<iii> viii; #ifndef DEBUG #define cerr if (0) cerr #endif const int INF = 1000000005; const ll LINF = 1000000000000000005; const int MAXN = 705; int n, m; vector<vi> a; bool gdc[MAXN][MAXN][MAXN], gdr[MAXN][MAXN][MAXN]; ll ans; ll count_rectangles(vector<vi> _a) { a = _a; n = SZ(a), m = SZ(a[0]); REP (i, 1, n - 1) { REP (j, 1, m - 1) { int mx = -1; REP (k, i, n - 1) { mxto(mx, a[k][j]); gdc[i][j][k] = mx < min(a[i - 1][j], a[k + 1][j]); } } } REP (i, 1, n - 1) { REP (j, 1, m - 1) { int mx = -1; REP (k, j, m - 1) { mxto(mx, a[i][k]); gdr[i][j][k] = mx < min(a[i][j - 1], a[i][k + 1]); } } } REP (i, 1, n - 1) { REP (j, 1, m - 1) { REP (k, i, n - 1) { REP (l, j, m - 1) { if (!gdc[i][l][k]) { break; } bool pos = 1; REP (p, i, k + 1) { if (!gdr[p][j][l]) { pos = 0; break; } } ans += pos; } } } } 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...