이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "rect.h"
using namespace std;
#define x first
#define y second
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vii = vector<vi>;
using pi = pair<int, int>;
using vpi = vector<pi>;
const int MX = 2e5 + 100;
int N, M;
ll count_rectangles(vii a) {
N = (int)a.size();
M = (int)a[0].size();
if (N == 3) {
vi sum(M, 0);
sum[0] = 0;
for (int i = 1; i < M - 1; ++i)
{
sum[i] = sum[i - 1] + int(a[1][i] < a[0][i] and a[1][i] < a[2][i]);
}
ll ats = 0;
int did = 0;
vi sk = a[1];
for (int s = 0; s < M - 2; ++s)
{
did = sk[s + 1];
for (int f = s + 2; sk[s] > did and f < M; ++f)
{
if (sk[f] > did and sum[f - 1] - sum[s] == f - s - 1) ats++;
did = max(did, sk[f]);
}
}
return ats;
}
return 0;
}
# | 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... |