QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#596425#9434. Italian Cuisineucup-team4770#WA 1ms5640kbC++141.6kb2024-09-28 15:46:042024-09-28 15:46:04

Judging History

你现在查看的是最新测评结果

  • [2024-09-28 15:46:04]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5640kb
  • [2024-09-28 15:46:04]
  • 提交

answer

//Date: 2024-09-28 15:21:39
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int rd() {
    int s=0,m=0;char ch=getchar();
    while(!isdigit(ch)) {if(ch=='-')m=1;ch=getchar();}
    while( isdigit(ch)) s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
    return m?-s:s;
}
bool MBE;
namespace SOLVER {
const double eps=1e-10;
int n,R,b[200005],ans;
struct Point{int x,y;} p,a[200005];
Point operator -(Point x,Point y) {return {x.x-y.x,x.y-y.y};}
double len(Point x) {return sqrt(x.x*x.x+x.y*x.y);}
int cross(Point x,Point y) {return x.x*y.y-x.y*y.x;}
pair<double,int> dis(Point x,Point y,Point z) {
    Point v1=y-x,v2=z-x;int ret=cross(v1,v2);
    return {fabs(ret/len(v1)),ret};
}
void MAIN() {
    cin>>n>>p.x>>p.y>>R;ans=0;
    for(int i=1;i<=n;i++) a[i].x=rd(),a[i].y=rd();
    for(int i=1;i<=n;i++) a[i+n]=a[i];a[1+n*2]=a[1];
    for(int i=1;i<=n*2;i++) b[i]=cross(a[i],a[i+1])+b[i-1];
    for(int i=1;i<=n;i++) {
        int l=i+1,r=i+n-1,pos=0;
        while(l<=r) {
            int mid=(l+r)>>1;pair<double,int> t=dis(a[i],a[mid],p);
            // cout<<a[i].x<<' '<<a[i].y<<' '<<a[mid].x<<' '<<a[mid].y<<' '<<t.first<<' '<<t.second<<endl;
            if(t.second>=0&&t.first+eps>=R) pos=mid,l=mid+1;
            else r=mid-1;
        }
        // cout<<pos<<endl;
        ans=max(ans,abs(b[pos-1]-b[i-1]+cross(a[pos],a[i])));
    }
    cout<<ans<<endl;
}
}
bool MED;
signed main() {
    //freopen(".in","r",stdin);freopen(".out","w",stdout);
    for(int tt=rd();tt;tt--) SOLVER::MAIN();
    // cerr<<(&MBE-&MED)/1024<<" KB, "<<1000*clock()/CLOCKS_PER_SEC<<" ms\n";
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 5552kb

input:

3
5
1 1 1
0 0
1 0
5 0
3 3
0 5
6
2 4 1
2 0
4 0
6 3
4 6
2 6
0 3
4
3 3 1
3 0
6 3
3 6
0 3

output:

5
24
0

result:

ok 3 number(s): "5 24 0"

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 5640kb

input:

1
6
0 0 499999993
197878055 -535013568
696616963 -535013568
696616963 40162440
696616963 499999993
-499999993 499999993
-499999993 -535013568

output:

286862654137719264

result:

wrong answer 1st numbers differ - expected: '0', found: '286862654137719264'