제출 #1219793

#제출 시각아이디문제언어결과실행 시간메모리
1219793Gabp건포도 (IOI09_raisins)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; const long long int INF = 1e18; int main() { ios::sync_with_stdio(false); cin.tie(0); int n,m; cin >> n >> m; vector<vector<long long int>> a(n, vector<long long int>(m)); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cin >> a[i][j]; vector<vector<long long int>> pref(n + 1, vector<long long int>(m + 1, 0)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { pref[i + 1][j + 1] = pref[i + 1][j] + pref[i][j + 1] + a[i][j] - pref[i][j]; } } auto f = [&](int x1, int y1, int x2, int y2) -> long long int { return pref[x2 + 1][y2 + 1] - pref[x2 + 1][y1] - pref[x1][y2 + 1] + pref[x1][y1]; }; vector dp(n, vector(n, vector(m, vector<int>(m, -1)))); auto solve = [&](auto self, int x1, int x2, int y1, int y2) -> long long int { if (dp[x1][x2][y1][y2] != -1) return dp[x1][x2][y1][y2]; if (x1 == x2 && y1 == y2) return 0; long long int lo = INF; for (int i = x1; i < x2; i++) lo = min(lo, self(self, x1, i, y1, y2) + self(self, i + 1, x2, y1, y2)); for (int i = y1; i < y2; i++) lo = min(lo, self(self, x1, x2, y1, i) + self(self, x1, x2, i + 1, y2)); dp[x1][x2][y1][y2] = f(x1, y1, x2, y2) + lo; }; cout << solve(0, n - 1, 0, m - 1); }

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

raisins.cpp: In function 'int main()':
raisins.cpp:36:16: error: no match for call to '(main()::<lambda(auto:47, int, int, int, int)>) (int, int, int, int)'
   36 |   cout << solve(0, n - 1, 0, m - 1);
      |           ~~~~~^~~~~~~~~~~~~~~~~~~~
raisins.cpp:26:16: note: candidate: 'template<class auto:47> main()::<lambda(auto:47, int, int, int, int)>'
   26 |   auto solve = [&](auto self, int x1, int x2, int y1, int y2) -> long long int {
      |                ^
raisins.cpp:26:16: note:   template argument deduction/substitution failed:
raisins.cpp:36:16: note:   candidate expects 5 arguments, 4 provided
   36 |   cout << solve(0, n - 1, 0, m - 1);
      |           ~~~~~^~~~~~~~~~~~~~~~~~~~