Submission #1121973

#TimeUsernameProblemLanguageResultExecution timeMemory
1121973Haciyev12Calvinball championship (CEOI15_teams)C++14
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define pb push_back #define in insert #define F first #define S second #define vll vector<ll> #define all(v) v.begin(),v.end() #define endl '\n' #define pii pair<ll,ll> using namespace std; const ll INF =1e18, mod = 1e6 + 7, N = 1e3 + 50; ll maxi,q = 1; ll n; ll cnt(ll w, ll e){ if(e > n){ return 0; } if(w == 0){ return 1; } return(((cnt(w - 1, e) * e ) % mod) + (cnt(w - 1, e + 1) % mod) ) % mod; } int dp[N][N]; int a[N]; void solve(){ cin >> n; if(n > 14){ for(int i =1; i<= n; i++){ cin >> a[i]; } dp[0][0] = 1; for(int i = 1; i <= n; i++){ for(int j = 1; j <= n; j++){ dp[i][j] = ((dp[i - 1][j] * j % mod) + dp[i - 1][j- 1]) % mod; } } ll ans = 0; for(int i = 1; i <= n; i++){ ans += dp[n][i] % mod; ans %= mod; } cout << ans % mod; return; } for(int i = 1; i <= n; i++){ cin >> a[i];//1 2 2 for(int j = 1; j < a[i]; j++){ q = (q + cnt(n - i,maxi)) % mod; /// space element }/// 1 , 2 0,2 maxi = max(a[i], maxi); } cout << q % mod << endl; } int main(){ fast; ll t = 1; // cin >> t; while(t--){ solve(); } return 0; }

Compilation message (stderr)

teams.cpp: In function 'void solve()':
teams.cpp:52:30: error: no matching function for call to 'max(int&, long long int&)'
   52 |         maxi = max(a[i], maxi);
      |                              ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from teams.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:
teams.cpp:52:30: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   52 |         maxi = max(a[i], maxi);
      |                              ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from teams.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:
teams.cpp:52:30: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   52 |         maxi = max(a[i], maxi);
      |                              ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from teams.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:
teams.cpp:52:30: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   52 |         maxi = max(a[i], maxi);
      |                              ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from teams.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:
teams.cpp:52:30: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   52 |         maxi = max(a[i], maxi);
      |                              ^