이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
#include <stack>
#include <bitset>
#include "rect.h"
using namespace std;
#define ll long long
//cin.tie(0);ios_base::sync_with_stdio(0);
const int MAXN = 2505;
int grid[MAXN][MAXN];
int n, m;
ll ans1() {
if (n == 1 || n == 2) {
return 0;
}
int cnt = 0;
for (int i = 1; i < m - 1; i++) {
int cur = grid[1][i - 1];
int mx = grid[1][i];
for (int j = i; j < m - 1; j++) {
mx = max(mx, grid[1][j]);
if (grid[1][j] >= cur || grid[1][j] >= grid[0][j] || grid[1][j] >= grid[2][j]) {
break;
}
if (grid[1][j] >= grid[1][j + 1] || mx >= cur || mx >= grid[1][j + 1]) {
continue;
}
cnt++;
}
}
return cnt;
}
ll count_rectangles(vector<vector<int>> a) {
n = a.size(); m = a[0].size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
grid[i][j] = a[i][j];
}
}
if (n <= 3) {
return ans1();
}
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... |