제출 #1229703

#제출 시각아이디문제언어결과실행 시간메모리
1229703im2xtremeRectangles (IOI19_rect)C++20
컴파일 에러
0 ms0 KiB
#include "rect.h"
#include <iostream>
#include <vector>
using namespace std;

int64_t count_rectangles(vector<vector<int>> a) {
    int n = a.size(), m = a[0].size();
    int64_t count = 0;

    for (int r1 = 1; r1 < n - 1; ++r1) {
        for (int r2 = r1; r2 < n - 1; ++r2) {
            for (int c1 = 1; c1 < m - 1; ++c1) {
                for (int c2 = c1; c2 < m - 1; ++c2) {
                    bool valid = true;
                    for (int i = r1; i <= r2 && valid; ++i) {
                        for (int j = c1; j <= c2 && valid; ++j) {
                            int h = a[i][j];
                            if (!(h < a[i][c1 - 1] && h < a[i][c2 + 1] &&
                                h < a[r1 - 1][j] && h < a[r2 + 1][j])) {
                                valid = false;
                            }
                        }
                    }
                    if (valid) count++;
                }
            }
        }
    }

    return count;
}

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

rect.cpp:6:9: error: ambiguating new declaration of 'int64_t count_rectangles(std::vector<std::vector<int> >)'
    6 | int64_t count_rectangles(vector<vector<int>> a) {
      |         ^~~~~~~~~~~~~~~~
In file included from rect.cpp:1:
rect.h:7:11: note: old declaration 'long long int count_rectangles(std::vector<std::vector<int> >)'
    7 | long long count_rectangles(std::vector<std::vector<int> > a);
      |           ^~~~~~~~~~~~~~~~