제출 #415331

#제출 시각아이디문제언어결과실행 시간메모리
415331meatrowDango Maker (JOI18_dango_maker)C++17
컴파일 에러
0 ms0 KiB
// #pragma GCC target ("avx2") // #pragma GCC optimization ("O3") #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const int MOD = 1e9 + 7; ll binpow(ll a, ll p, int mod = MOD) { ll res = 1; while (p) { if (p & 1) { (res *= a) %= mod; } p >>= 1; (a *= a) %= mod; } return res; } ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); } const int N = 3005; int dp[N][N][3]; char a[N][N]; void solve() { int n, m; cin >> n >> m; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> a[i][j]; } } vector<int> last(3); for (int s = 0; s < n + m - 1; s++) { last[0] = max<int>(last[0], last[1], last[2]); for (int i = 0; i < min(n, s + 1); i++) { int j = s - i; if (j < 0 || j >= m) continue; dp[i][j][0] = *max_element(last.begin(), last.end()); if (i && a[i - 1][j] == 'R' && a[i][j] == 'G' && a[i + 1][j] == 'W') dp[i][j][1] = max(last[0], last[1]) + 1; if (j && a[i][j - 1] == 'R' && a[i][j] == 'G' && a[i][j + 1] == 'W') dp[i][j][2] = max(last[0], last[2]) + 1; last = {dp[i][j][0], dp[i][j][1], dp[i][j][2]}; } } cout << *max_element(last.begin(), last.end()) << '\n'; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T = 1; // cin >> T; for (int tc = 1; tc <= T; tc++) { // cout << "Case #" << tc << ": "; solve(); } return 0; }

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

In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from dango_maker.cpp:3:
/usr/include/c++/10/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:44:53:   required from here
/usr/include/c++/10/bits/stl_algobase.h:303:17: error: '__comp' cannot be used as a function
  303 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~