제출 #1189387

#제출 시각아이디문제언어결과실행 시간메모리
1189387pensive말 (IOI15_horses)C++20
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;
#define REP(a,i,n) for (ll i=a;i<n;i++)
#define ll long long
#define ssize 500'000

const ll MOD = 1e9+7;
int N;
ll X[ssize], Y[ssize];

ll solve() {
    //ll mx=0, hNum=1;
    long double emx = 0, hiNum=0;
    REP(0,i,N) {
        hiNum += log10(X[i]);
        emx = max(emx, hiNum+log10(Y[i]));
    }
    return pow(10, emx, MOD);
}

ll init(int n, int x[], int y[]) {
    N = n;
    REP(0,i,n) {
        X[i] = x[i];
        Y[i] = y[i];
    }
    return solve();
}

ll updateX(int pos, int val) {
    X[pos] = val;
    return solve();
}

ll updateY(int pos, int val) {
    Y[pos] = val;
    return solve();
}

컴파일 시 표준 에러 (stderr) 메시지

horses.cpp: In function 'long long int solve()':
horses.cpp:21:15: error: no matching function for call to 'pow(int, long double&, const long long int&)'
   21 |     return pow(10, emx, MOD);
      |            ~~~^~~~~~~~~~~~~~
In file included from horses.cpp:3:
/usr/include/c++/11/cmath:415:5: note: candidate: 'template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)'
  415 |     pow(_Tp __x, _Up __y)
      |     ^~~
/usr/include/c++/11/cmath:415:5: note:   template argument deduction/substitution failed:
horses.cpp:21:15: note:   candidate expects 2 arguments, 3 provided
   21 |     return pow(10, emx, MOD);
      |            ~~~^~~~~~~~~~~~~~
In file included from /usr/include/features.h:486,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/c++config.h:586,
                 from /usr/include/c++/11/iostream:38,
                 from horses.cpp:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:140:1: note: candidate: 'double pow(double, double)'
  140 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
      | ^~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:140:1: note:   candidate expects 2 arguments, 3 provided
In file included from horses.cpp:3:
/usr/include/c++/11/cmath:392:3: note: candidate: 'constexpr long double std::pow(long double, long double)'
  392 |   pow(long double __x, long double __y)
      |   ^~~
/usr/include/c++/11/cmath:392:3: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/11/cmath:388:3: note: candidate: 'constexpr float std::pow(float, float)'
  388 |   pow(float __x, float __y)
      |   ^~~
/usr/include/c++/11/cmath:388:3: note:   candidate expects 2 arguments, 3 provided