# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
266781 | dennisstar | Rectangles (IOI19_rect) | C++17 | 5076 ms | 376968 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "rect.h"
#define eb emplace_back
#define hsh(a, b, c) ((a)*6250000ll+(b)*2500ll+c)
using namespace std;
using ll = long long;
int N, M;
vector<ll> H, V;
long long count_rectangles(vector<vector<int>> a) {
N=a.size(); M=a[0].size();
vector<vector<int>> l, r, u, d;
for (int i=0; i<N; i++)
l.eb(vector<int>(M, -1));
r=u=d=l;
for (int i=1; i<N-1; i++) {
vector<int> st;
for (int j=0; j<M; j++) {
while (st.size()&&a[i][st.back()]<a[i][j]) st.pop_back();
if (st.size()&&st.back()<j-1) H.eb(hsh(st.back(), j, i));
st.eb(j);
}
st.clear();
for (int j=M-1; j>=0; j--) {
while (st.size()&&a[i][st.back()]<a[i][j]) st.pop_back();
if (st.size()&&st.back()>j+1) H.eb(hsh(j, st.back(), i));
st.eb(j);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |