QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#389975 | #5103. Fair Division | 0_GB_RAM# | Compile Error | / | / | C++23 | 1.3kb | 2024-04-14 22:41:32 | 2024-04-14 22:41:32 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define int ll
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) begin(x),end(x)
#define sz(x) (int)((x).size())
using pii=pair<int,int>;
using vi=vector<int>;
#define fi first
#define se second
#define pb push_back
typedef __int128 sll;
bool bad(sll a, sll b)
{
return (log(a) + log(b)) > 36*log(10);
}
sll bpow(sll a, sll b)
{
sll res = 1;
while (b>0)
{
if (b%2){
if (bad(res, a))
return -1;
res*=a;
}
b/=2;
if (bad(a, a))
return -1;
a*=a;
}
return res;
}
bool check(sll n, sll R, sll p, sll q)
{
R *= (q-p);
q = bpow(q, n);
p = bpow(p, n);
if (p==-1 || q==-1)
return false;
return R%(q-p)==0;
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(cin.failbit);
int n, R;
cin>>n>>R;
for (int q=1; ; q++)
{
for (int p=q-1; p>0; p--)
if (check(n, R, p, q))
{
cout<<q-p<<" "<<q<<"\n";
exit(0);
}
if (clock()*1.0/CLOCKS_PER_SEC > 2.9)
break;
}
cout<<"impossible\n";
}
Details
answer.code: In function ‘bool bad(sll, sll)’: answer.code:19:16: error: call of overloaded ‘log(sll&)’ is ambiguous 19 | return (log(a) + log(b)) > 36*log(10); | ~~~^~~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/13/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/13/bits/c++config.h:679, from /usr/include/c++/13/cassert:43, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:33, from answer.code:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:104:1: note: candidate: ‘double log(double)’ 104 | __MATHCALL_VEC (log,, (_Mdouble_ __x)); | ^~~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:114: /usr/include/c++/13/cmath:1009:3: note: candidate: ‘constexpr __gnu_cxx::__bfloat16_t std::log(__gnu_cxx::__bfloat16_t)’ 1009 | log(__gnu_cxx::__bfloat16_t __x) | ^~~ /usr/include/c++/13/cmath:919:3: note: candidate: ‘constexpr _Float128 std::log(_Float128)’ 919 | log(_Float128 __x) | ^~~ /usr/include/c++/13/cmath:733:3: note: candidate: ‘constexpr _Float64 std::log(_Float64)’ 733 | log(_Float64 __x) | ^~~ /usr/include/c++/13/cmath:639:3: note: candidate: ‘constexpr _Float32 std::log(_Float32)’ 639 | log(_Float32 __x) | ^~~ /usr/include/c++/13/cmath:545:3: note: candidate: ‘constexpr _Float16 std::log(_Float16)’ 545 | log(_Float16 __x) | ^~~ /usr/include/c++/13/cmath:326:3: note: candidate: ‘constexpr long double std::log(long double)’ 326 | log(long double __x) | ^~~ /usr/include/c++/13/cmath:322:3: note: candidate: ‘constexpr float std::log(float)’ 322 | log(float __x) | ^~~ answer.code:19:25: error: call of overloaded ‘log(sll&)’ is ambiguous 19 | return (log(a) + log(b)) > 36*log(10); | ~~~^~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:104:1: note: candidate: ‘double log(double)’ 104 | __MATHCALL_VEC (log,, (_Mdouble_ __x)); | ^~~~~~~~~~~~~~ /usr/include/c++/13/cmath:1009:3: note: candidate: ‘constexpr __gnu_cxx::__bfloat16_t std::log(__gnu_cxx::__bfloat16_t)’ 1009 | log(__gnu_cxx::__bfloat16_t __x) | ^~~ /usr/include/c++/13/cmath:919:3: note: candidate: ‘constexpr _Float128 std::log(_Float128)’ 919 | log(_Float128 __x) | ^~~ /usr/include/c++/13/cmath:733:3: note: candidate: ‘constexpr _Float64 std::log(_Float64)’ 733 | log(_Float64 __x) | ^~~ /usr/include/c++/13/cmath:639:3: note: candidate: ‘constexpr _Float32 std::log(_Float32)’ 639 | log(_Float32 __x) | ^~~ /usr/include/c++/13/cmath:545:3: note: candidate: ‘constexpr _Float16 std::log(_Float16)’ 545 | log(_Float16 __x) | ^~~ /usr/include/c++/13/cmath:326:3: note: candidate: ‘constexpr long double std::log(long double)’ 326 | log(long double __x) | ^~~ /usr/include/c++/13/cmath:322:3: note: candidate: ‘constexpr float std::log(float)’ 322 | log(float __x) | ^~~