Submission #550642

#TimeUsernameProblemLanguageResultExecution timeMemory
550642Vladth11Calvinball championship (CEOI15_teams)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define debug(x) cerr << #x << " " << x << "\n" #define debugs(x) cerr << #x << " " << x << " " using namespace std; typedef long long ll; typedef pair <ll, ll> pii; const ll NMAX = 10001; const ll VMAX = 10001; const ll INF = (1LL << 55); const ll MOD = 1000007; const ll BLOCK = 1000000; const ll base = 1000000001; const ll nr_of_bits = 18; ll dp[2][NMAX][3]; ll v[NMAX]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n, i, j; cin >> n; for(i = 1; i <= n; i++){ cin >> v[i]; } dp[0][0][1] = 1; ll sum = 0; for(i = 1; i <= n; i++){ ll act = i&1; ll last = 1 - act; for(j = 1; j <= i; j++){ /// Nu deschid culoare noua dp[act][j][0] = 1LL * (dp[last][j][0] * j) % MOD; dp[act][j][0] %= MOD; dp[act][j][0] += 1LL * (dp[last][j][1] * min(j, v[i] - 1)) % MOD; dp[act][j][0] %= MOD; if(j >= v[i]) dp[act][j][1] = dp[last][j][1]; dp[act][j][2] = 1LL * (dp[last][j][2] * j) % MOD; dp[act][j][2] %= MOD; dp[act][j][2] += 1LL * (dp[last][j][1] * max(0, j - v[i])) % MOD; dp[act][j][2] %= MOD; /// Deschid o culoare noua dp[act][j][0] += dp[last][j - 1][0]; dp[act][j][0] %= MOD; if(j < v[j]){ dp[act][j][0] += dp[last][j - 1][1]; dp[act][j][0] %= MOD; } if(j == v[i]){ dp[act][j][1] += dp[last][j - 1][1]; dp[act][j][1] %= MOD; } dp[act][j][2] += dp[last][j - 1][2]; dp[act][j][2] %= MOD; if(j > v[i]){ dp[act][j][2] += dp[last][j - 1][1] % MOD; dp[act][j][2] %= MOD; } if(i == n){ sum += dp[act][j][0]; sum %= MOD; } } for(j = 0; j <= i; j++) dp[last][j][0] = dp[last][j][1] = dp[last][j][2] = 0; } cout << (sum + 1) % MOD; return 0; }

Compilation message (stderr)

teams.cpp: In function 'int main()':
teams.cpp:44:69: error: no matching function for call to 'max(int, ll)'
   44 |             dp[act][j][2] += 1LL * (dp[last][j][1] * max(0, j - v[i])) % MOD;
      |                                                                     ^
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:44:69: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   44 |             dp[act][j][2] += 1LL * (dp[last][j][1] * max(0, j - v[i])) % MOD;
      |                                                                     ^
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:44:69: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   44 |             dp[act][j][2] += 1LL * (dp[last][j][1] * max(0, j - v[i])) % MOD;
      |                                                                     ^
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:44:69: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   44 |             dp[act][j][2] += 1LL * (dp[last][j][1] * max(0, j - v[i])) % MOD;
      |                                                                     ^
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:44:69: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   44 |             dp[act][j][2] += 1LL * (dp[last][j][1] * max(0, j - v[i])) % MOD;
      |                                                                     ^