QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#689834 | #9434. Italian Cuisine | DarwinA66 | Compile Error | / | / | C++20 | 2.9kb | 2024-10-30 18:53:14 | 2024-10-30 18:53:15 |
Judging History
answer
#include<bits/stdc++.h>
#define ll __int128_t
#define eps 1e-12
using namespace std;
// #define double long double
const int N=100010;
namespace my128 { // 读入优化封装,支持__int128
using i64 = __int128_t;
i64 abs(const i64 &x) {
return x > 0 ? x : -x;
}
auto &operator>>(istream &it, i64 &j) {
string val;
it >> val;
reverse(val.begin(), val.end());
i64 ans = 0;
bool f = 0;
char c = val.back();
val.pop_back();
for (; c < '0' || c > '9'; c = val.back(), val.pop_back()) {
if (c == '-') {
f = 1;
}
}
for (; c >= '0' && c <= '9'; c = val.back(), val.pop_back()) {
ans = ans * 10 + c - '0';
}
j = f ? -ans : ans;
return it;
}
auto &operator<<(ostream &os, const i64 &j) {
string ans;
function<void(i64)> write = [&](i64 x) {
if (x < 0) ans += '-', x = -x;
if (x > 9) write(x / 10);
ans += x % 10 + '0';
};
write(j);
return os << ans;
}
} // namespace my128
using namespace my128;
struct point{
ll x;
ll y;
}P[N];
ll S[N];
ll S_s[N];
int n;
ll xr,yr,r;
ll M(point a,point b)
{
return 1ll*a.x*b.y-1ll*b.x*a.y;
}
ll find_area(int left,int right)
{
if(left<=right)return S_s[right-1]-S_s[left-1]-(M(P[left],P[right]));
else{
ll temp=S_s[n-1]-S_s[left-1]+S_s[right-1]+S[n];
return temp-M(P[left],P[right]);
}
}
double find_d(int left,int right)
{
if(left==right)return sqrt(P[left].x*P[left].x+P[left].y*P[left].y)*1.00;
double d1=sqrt((P[left].x-P[right].x)*(P[left].x-P[right].x)+(P[left].y-P[right].y)*(P[left].y-P[right].y))*1.00;
double d=M(P[left],P[right])*1.00/d1;
//printf("%d %d %lf %lf\n",left,right,d1,d);
return d;
}
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
// scanf("%lld %lld %lld",&xr,&yr,&r);
cin >> xr >> yr >> r;
for(int i=1;i<=n;i++)
{
// scanf("%lld %lld",&P[i].x,&P[i].y);
cin >> P[i].x >> P[i].y;
P[i].x=(P[i].x)-xr*1ll;
P[i].y=(P[i].y)-yr*1ll;
}
S_s[0]=0ll;
for(int i=1;i<=n;i++)
{
if(i<n)S[i]=M(P[i],P[i+1]);
else S[i]=M(P[i],P[1]);
//printf("%lld\n",S[i]);
S_s[i]=S_s[i-1]+S[i];
}
int curr=1;
ll ans=0ll;
for(int i=1;i<=n;i++)
{
while(find_d(i,(curr%n)+1)+eps>=1.00*r)
{
curr=(curr%n)+1;
}
ans=max(1ll*ans,1ll*find_area(i,curr));
}
curr=n;
// printf("%lld\n",ans);
cout << ans << "\n";
}
return 0;
}
/*
197878055 -535013568
696616963 40162440
*/
詳細信息
answer.code: In function ‘double find_d(int, int)’: answer.code:66:31: error: call of overloaded ‘sqrt(__int128)’ is ambiguous 66 | if(left==right)return sqrt(P[left].x*P[left].x+P[left].y*P[left].y)*1.00; | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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:143:1: note: candidate: ‘double sqrt(double)’ 143 | __MATHCALL (sqrt,, (_Mdouble_ __x)); | ^~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:114: /usr/include/c++/13/cmath:442:3: note: candidate: ‘constexpr long double std::sqrt(long double)’ 442 | sqrt(long double __x) | ^~~~ /usr/include/c++/13/cmath:438:3: note: candidate: ‘constexpr float std::sqrt(float)’ 438 | sqrt(float __x) | ^~~~ answer.code:67:19: error: call of overloaded ‘sqrt(__int128)’ is ambiguous 67 | double d1=sqrt((P[left].x-P[right].x)*(P[left].x-P[right].x)+(P[left].y-P[right].y)*(P[left].y-P[right].y))*1.00; | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:143:1: note: candidate: ‘double sqrt(double)’ 143 | __MATHCALL (sqrt,, (_Mdouble_ __x)); | ^~~~~~~~~~ /usr/include/c++/13/cmath:442:3: note: candidate: ‘constexpr long double std::sqrt(long double)’ 442 | sqrt(long double __x) | ^~~~ /usr/include/c++/13/cmath:438:3: note: candidate: ‘constexpr float std::sqrt(float)’ 438 | sqrt(float __x) | ^~~~ answer.code: In function ‘int main()’: answer.code:75:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 75 | scanf("%d",&T); | ~~~~~^~~~~~~~~ answer.code:78:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 78 | scanf("%d",&n); | ~~~~~^~~~~~~~~