제출 #1346811

#제출 시각아이디문제언어결과실행 시간메모리
1346811kawhiet호화 벙커 (IZhO13_burrow)C++20
컴파일 에러
0 ms0 KiB
a#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 47
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m, k;
    cin >> n >> m >> k;
    vector<vector<int>> a(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    int l = 0, r = 2e9, ans = 0;
    while (l + 1 < r) {
        int tm = (l + r) / 2;
        vector<vector<int>> b(n, vector<int>(m));
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                b[i][j] = (a[i][j] >= tm);
            }
        }
        vector<vector<int>> p(n, vector<int>(m + 1));
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                p[i][j + 1] = p[i][j] + b[i][j];
            }
        }
        int mx = 0;
        for (int s = 1; s <= m; s++) {
            for (int j = 0; j + s <= m; j++) {
                int sum = 0;
                for (int i = 0; i < n; i++) {
                    if (p[i][j + s] - p[i][j] == s) {
                        sum += s;
                    } else {
                        sum = 0;
                    }
                    mx = max(mx, sum);
                    if (mx >= k) break;
                }
            }
            if (mx >= k) break;
        }
        if (mx >= k) {
            ans = mx;
            l = tm;
        } else {
            r = tm;
        }
    }
    cout << l << ' ' << ans << '\n';
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

burrow.cpp:1:2: error: stray '#' in program
    1 | a#include <bits/stdc++.h>
      |  ^
burrow.cpp:1:1: error: 'a' does not name a type
    1 | a#include <bits/stdc++.h>
      | ^
burrow.cpp: In function 'int main()':
burrow.cpp:11:5: error: 'ios' has not been declared
   11 |     ios::sync_with_stdio(false);
      |     ^~~
burrow.cpp:12:5: error: 'cin' was not declared in this scope
   12 |     cin.tie(nullptr);
      |     ^~~
burrow.cpp:15:12: error: 'vector' was not declared in this scope
   15 |     vector<vector<int>> a(n, vector<int>(m));
      |            ^~~~~~
burrow.cpp:15:19: error: expected primary-expression before 'int'
   15 |     vector<vector<int>> a(n, vector<int>(m));
      |                   ^~~
burrow.cpp:18:20: error: 'a' was not declared in this scope
   18 |             cin >> a[i][j];
      |                    ^
burrow.cpp:24:23: error: expected primary-expression before 'int'
   24 |         vector<vector<int>> b(n, vector<int>(m));
      |                       ^~~
burrow.cpp:27:17: error: 'b' was not declared in this scope
   27 |                 b[i][j] = (a[i][j] >= tm);
      |                 ^
burrow.cpp:27:28: error: 'a' was not declared in this scope
   27 |                 b[i][j] = (a[i][j] >= tm);
      |                            ^
burrow.cpp:30:23: error: expected primary-expression before 'int'
   30 |         vector<vector<int>> p(n, vector<int>(m + 1));
      |                       ^~~
burrow.cpp:33:17: error: 'p' was not declared in this scope
   33 |                 p[i][j + 1] = p[i][j] + b[i][j];
      |                 ^
burrow.cpp:33:41: error: 'b' was not declared in this scope
   33 |                 p[i][j + 1] = p[i][j] + b[i][j];
      |                                         ^
burrow.cpp:41:25: error: 'p' was not declared in this scope
   41 |                     if (p[i][j + s] - p[i][j] == s) {
      |                         ^
burrow.cpp:46:26: error: 'max' was not declared in this scope; did you mean 'mx'?
   46 |                     mx = max(mx, sum);
      |                          ^~~
      |                          mx
burrow.cpp:59:5: error: 'cout' was not declared in this scope
   59 |     cout << l << ' ' << ans << '\n';
      |     ^~~~