Submission #154230

#TimeUsernameProblemLanguageResultExecution timeMemory
154230mhy908Calvinball championship (CEOI15_teams)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define mod 1000007 using namespace std; typedef long long LL; int n; int arr[10010], maxx; int newp[10010]; LL dp[10010], dp2[10010]; LL temp=0; int t2; LL power(LL a, LL b) { if(b==0)return 1; LL ret=power(a, b/2); if(b%2)return ret*ret%mod*a%mod; return ret*ret%mod; } int main() { scanf("%d", &n); for(int i=1; i<=n; i++){ scanf("%d", &arr[i]); maxx=max(maxx, arr[i]); newp[i]=maxx; } dp[n+1]=dp2[n+1]=1; t2=n+1; for(int i=n; i>=1; i--){ if(newp[i-1]==newp[i]){ temp+=(LL)(arr[i]-1)*power((LL)newp[i], (LL)t2-(LL)i-1); temp%=mod; } else{ temp+=(LL)(arr[i]-1)*power((LL)newp[i], (LL)t2-(LL)i-1); temp%=mod; dp[i]=(temp*dp2[t2]+dp[t2])%mod; dp2[i]=power((LL)newp[i], min(t2, (LL)n)-(LL)i+1)*dp2[t2]%mod; t2=i; temp=0; } } printf("%lld", dp[1]); } // 16603

Compilation message (stderr)

teams.cpp: In function 'int main()':
teams.cpp:37:52: error: no matching function for call to 'min(int&, LL)'
             dp2[i]=power((LL)newp[i], min(t2, (LL)n)-(LL)i+1)*dp2[t2]%mod;
                                                    ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from teams.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
teams.cpp:37:52: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'LL {aka long long int}')
             dp2[i]=power((LL)newp[i], min(t2, (LL)n)-(LL)i+1)*dp2[t2]%mod;
                                                    ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from teams.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
teams.cpp:37:52: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'LL {aka long long int}')
             dp2[i]=power((LL)newp[i], min(t2, (LL)n)-(LL)i+1)*dp2[t2]%mod;
                                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from teams.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
teams.cpp:37:52: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
             dp2[i]=power((LL)newp[i], min(t2, (LL)n)-(LL)i+1)*dp2[t2]%mod;
                                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from teams.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
teams.cpp:37:52: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
             dp2[i]=power((LL)newp[i], min(t2, (LL)n)-(LL)i+1)*dp2[t2]%mod;
                                                    ^
teams.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
teams.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &arr[i]);
         ~~~~~^~~~~~~~~~~~~~~