Submission #892994

#TimeUsernameProblemLanguageResultExecution timeMemory
892994MinbaevDango Maker (JOI18_dango_maker)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int mod= 1e9 +7; const int N=1e5*4; void solve(){ int n,m,k; cin>>n>>m; char arr[n+5][n+5]; for(int i = 1;i<=n;i++){ for(int j = 1;j<=m;j++){ cin>>arr[i][j]; } } int ans = 0; for(int j = 1;j<=m;j++){ int ind = 1,x = 1,y = j; vector<vector<int>>dp(max(n+1,j+1),{0,0,0}); while(x<=n&&y>=1){ dp[ind][0] = max({dp[ind-1][0],dp[ind-1][1],dp[ind-1][2]}); if(arr[x][y-1]=='R'&&arr[x][y]=='G'&&arr[x][y+1]=='W')dp[ind][1] = max(dp[ind-1][0],dp[ind-1][1]) + 1; if(arr[x-1][y]=='R'&&arr[x][y]=='G'&&arr[x+1][y]=='W')dp[ind][2] = max(dp[ind-1][0],dp[ind-1][2]) + 1; x++;y--;ind++; } ind--; ans += max({dp[ind][0],dp[ind][1],dp[ind][2]}); } for(int i = 2;i<=n;i++){ int ind = 1,x = i,y = m; vector<vector<int>>dp(max(n+1,(m - (i - 1)),{0,0,0}); while(x<=n&&y>=1){ dp[ind][0] = max({dp[ind-1][0],dp[ind-1][1],dp[ind-1][2]}); if(arr[x][y-1]=='R'&&arr[x][y]=='G'&&arr[x][y+1]=='W')dp[ind][1] = max(dp[ind-1][0],dp[ind-1][1]) + 1; if(arr[x-1][y]=='R'&&arr[x][y]=='G'&&arr[x+1][y]=='W')dp[ind][2] = max(dp[ind-1][0],dp[ind-1][2]) + 1; x++;y--;ind++; } ind--; ans += max({dp[ind][0],dp[ind][1],dp[ind][2]}); } cout<<ans<<" "; //ne spizdil , a adaptiroval } signed main() { // freopen("seq.in", "r", stdin); // freopen("seq.out", "w", stdout); ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); int tt=1;//cin>>tt; while(tt--)solve(); }

Compilation message (stderr)

dango_maker.cpp: In function 'void solve()':
dango_maker.cpp:39:54: error: no matching function for call to 'max(int, int, <brace-enclosed initializer list>)'
   39 |   vector<vector<int>>dp(max(n+1,(m - (i - 1)),{0,0,0});
      |                                                      ^
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:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
dango_maker.cpp:39:54: note:   candidate expects 2 arguments, 3 provided
   39 |   vector<vector<int>>dp(max(n+1,(m - (i - 1)),{0,0,0});
      |                                                      ^
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:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
dango_maker.cpp:39:54: note:   couldn't deduce template parameter '_Compare'
   39 |   vector<vector<int>>dp(max(n+1,(m - (i - 1)),{0,0,0});
      |                                                      ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from dango_maker.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
dango_maker.cpp:39:54: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   39 |   vector<vector<int>>dp(max(n+1,(m - (i - 1)),{0,0,0});
      |                                                      ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from dango_maker.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
dango_maker.cpp:39:54: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   39 |   vector<vector<int>>dp(max(n+1,(m - (i - 1)),{0,0,0});
      |                                                      ^
dango_maker.cpp:8:10: warning: unused variable 'k' [-Wunused-variable]
    8 |  int n,m,k;
      |          ^