제출 #1278386

#제출 시각아이디문제언어결과실행 시간메모리
1278386hoangtien69Dango Maker (JOI18_dango_maker)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 3005;

int n, m;
int dp[MAXN][2];
char a[MAXN][MAXN];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            cin >> a[i][j];
        }
    }
    int res = 0;
    for (int peal = 1; peal <= n + m; peal++)
    {
        memset(dp, 0, sizeof dp);
        int cur = 0;
        for (int j = min(m, peal - 1), i = peal - j; j >= 1 and i <= n; j--, i++)
        {
            dp[j][0] = max(dp[j + 1][0], dp[j + 3][1] + (a[i][j] == 'R' and a[i][j + 1] == 'G' and a[i][j + 2] == 'W'));
            dp[j][1] = max(dp[j + 1][1], dp[j + 1][0] + (a[i][j] == 'R' and a[i + 1][j] == 'G' and a[i + 2][j] == 'W'));
            cur = max(dp[j][0], dp[j][1], cur);
        }
        res += cur;
    }
    cout << res;
}

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

In file included from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from dango_maker.cpp:1:
/usr/include/c++/13/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
dango_maker.cpp:32:22:   required from here
/usr/include/c++/13/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~