답안 #1032345

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1032345 2024-07-23T15:57:44 Z shmax Rectangles (IOI19_rect) C++17
0 / 100
235 ms 28312 KB
#include "rect.h"
#include <bits/stdc++.h>

using namespace std;
using i32 = int;
#define int long long
#define len(x) (int)(x.size())
#define inf 1000'000'000'000'000'000LL
#define all(x) x.begin(), x.end()
#define low_bit(x) (x & (-x))

template<typename T>
using vec = vector<T>;

long long count_rectangles(std::vector<std::vector<i32>> a) {
    int n = len(a);
    int m = len(a[0]);
    int ans = 0;
    for (int i = 1; i < n - 1; i++) {
        for (int j = 1; j < m - 1; j++) {
            if (a[i][j] >= a[i - 1][j]) continue;
            vec<bool> good_layers(n, true);
            vec<int> mx(n, 0);
            for (int k = j; k < m - 1; k++) {
                int mxs = 0;
                if (a[i][k] >= a[i - 1][k]) break;
                for (int l = i; l < n - 1; l++) {
                    if (!good_layers[l]) continue;
                    bool good = true;
                    bool good1 = true;
                    {
                        int h = k;
                        mx[l] = max(mx[l], (int) a[l][h]);
                        mxs = max(mxs, (int) a[l][h]);
                        if (mxs >= min(a[i - 1][h], a[l + 1][h])) {
                            good = false;
                        }
                        if (a[l][h] >= a[i - 1][h]) {
                            good1 = false;
                        }
                    }
                    good_layers[l] = false;
                    if (!good1) break;
                    if (mx[l] >= min(a[l][j - 1], a[l][k + 1])) {
                        good = false;
                        good_layers[l] = true;
                        break;
                    }
                    if (!good) continue;
                    good_layers[l] = true;
                    ans++;
                }
            }
        }
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 436 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 432 KB Output is correct
6 Incorrect 0 ms 432 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 436 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 432 KB Output is correct
6 Incorrect 0 ms 432 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 436 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 432 KB Output is correct
6 Incorrect 0 ms 432 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 436 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 432 KB Output is correct
6 Incorrect 0 ms 432 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 348 KB Output is correct
2 Correct 14 ms 544 KB Output is correct
3 Correct 1 ms 444 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Incorrect 1 ms 604 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 235 ms 28312 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 436 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 432 KB Output is correct
6 Incorrect 0 ms 432 KB Output isn't correct
7 Halted 0 ms 0 KB -