Submission #145380

#TimeUsernameProblemLanguageResultExecution timeMemory
145380jacynkaaRectangles (IOI19_rect)C++14
37 / 100
5095 ms28408 KiB
#include <bits/stdc++.h> #include <math.h> #include <chrono> using namespace std; #pragma GCC optimize("-O3") #define endl "\n" #define mp make_pair #define st first #define nd second #define pii pair<int, int> #define pb push_back #define _upgrade ios_base::sync_with_stdio(0), cout.setf(ios::fixed), cout.precision(10) //cin.tie(0); cout.tie(0); #define REP(i, n) for (int i = 0; i < (n); ++i) #define FWD(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) for (int i = 0; i < (n); ++i) #define fwd(i, a, b) for (int i = (a); i < (b); ++i) #define all(c) (c).begin(), (c).end() #define what(x) cerr << #x << " is " << x << endl; int ans = 0; vector<pair<pii, pii>> odp; void wypisz() { sort(all(odp)); for (auto a : odp) { cerr << a.st.st << " " << a.st.nd << " " << a.nd.st << " " << a.nd.nd << endl; } } long long count_rectangles(vector<vector<int>> A) { int n = A.size(); int m = A[0].size(); for (int i = 1; i < n - 1; i++) for (int j = 1; j < m - 1; j++) for (int k = i; k < n - 1; k++) for (int l = j; l < m - 1; l++) { bool ok = true; for (int p = i; p <= k && ok; p++) for (int q = j; q <= l && ok; q++) if (A[p][q] >= min(min(A[i - 1][q], A[k + 1][q]), min(A[p][j - 1], A[p][l + 1]))) ok = false; if (ok) { ans++; odp.pb(mp(mp(i, j), mp(k, l))); } } return ans; } /* main() { _upgrade; string S; cin >> S; int a, b; cin >> a >> b; vector<vector<int>> X(a, vector<int>(b)); rep(i, a) rep(j, b) cin >> X[i][j]; cout << count_rectangles(X) << endl; // wypisz(); } */
#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...