Submission #633655

#TimeUsernameProblemLanguageResultExecution timeMemory
633655lkh3happy팔찌 (kriii4_V)C++14
Compilation error
0 ms0 KiB
#include <stdio.h> #include <algorithm> #include <vector> using namespace std; long long mod=1e9+7, ep[1000001], mi[1000001]={1}, kp[1000001]={1}; long long po(long long x){ long long sum=1, y=mod-2; for(;y;y>>=1, x=x*x%mod) if(y&1) sum=sum*x%mod; return sum; } int main(){ long long n, k, ans=0; scanf("%lld%lld\n", &n, &k); for(int i=1;i<=n;i++) ep[i]=i; for(int i=2;i<=n;i++) if(ep[i]==i) for(int j=i;j<=n;j+=i) ep[j]=ep[j]/i*(i-1); for(int i=1;i<=max(n, 4);i++) kp[i]=kp[i-1]*k%mod, ep[i]=(ep[i]*(mi[i]=po(i))+ep[i-1])%mod; for(int i=1;i<=n;i++) ans=(ans+(kp[i]*mi[i]%mod)*ep[n/i]*2+((i&1)?kp[i/2+1]*2:kp[i/2]+kp[i/2+1]))%mod; printf("%lld\n", (ans*mi[4]+1)%mod); return 0; }

Compilation message (stderr)

V.cpp: In function 'int main()':
V.cpp:19:28: error: no matching function for call to 'max(long long int&, int)'
   19 |     for(int i=1;i<=max(n, 4);i++) kp[i]=kp[i-1]*k%mod, ep[i]=(ep[i]*(mi[i]=po(i))+ep[i-1])%mod;
      |                            ^
In file included from /usr/include/c++/10/algorithm:61,
                 from V.cpp:2:
/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:
V.cpp:19:28: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   19 |     for(int i=1;i<=max(n, 4);i++) kp[i]=kp[i-1]*k%mod, ep[i]=(ep[i]*(mi[i]=po(i))+ep[i-1])%mod;
      |                            ^
In file included from /usr/include/c++/10/algorithm:61,
                 from V.cpp:2:
/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:
V.cpp:19:28: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   19 |     for(int i=1;i<=max(n, 4);i++) kp[i]=kp[i-1]*k%mod, ep[i]=(ep[i]*(mi[i]=po(i))+ep[i-1])%mod;
      |                            ^
In file included from /usr/include/c++/10/algorithm:62,
                 from V.cpp:2:
/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:
V.cpp:19:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   19 |     for(int i=1;i<=max(n, 4);i++) kp[i]=kp[i-1]*k%mod, ep[i]=(ep[i]*(mi[i]=po(i))+ep[i-1])%mod;
      |                            ^
In file included from /usr/include/c++/10/algorithm:62,
                 from V.cpp:2:
/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:
V.cpp:19:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   19 |     for(int i=1;i<=max(n, 4);i++) kp[i]=kp[i-1]*k%mod, ep[i]=(ep[i]*(mi[i]=po(i))+ep[i-1])%mod;
      |                            ^
V.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     scanf("%lld%lld\n", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~