QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#751848#9434. Italian Cuisine111111qqqqqqWA 0ms3708kbC++141.4kb2024-11-15 21:00:052024-11-15 21:00:06

Judging History

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

  • [2024-11-15 21:00:06]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3708kb
  • [2024-11-15 21:00:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define db double
#define lowbit(x) x&(-x)
#define cerr(x) cout<<#x<<"="<<x<<endl
#define fi first
#define se second
#define N 100010
const db eps=1e-10;
int n;
ll rx,ry,r;
struct node{
    ll x,y;
    node(){}
    node(ll _x,ll _y):x(_x),y(_y){}
    node operator+(const node&t) const {return {x+t.x,y+t.y};}
    node operator-(const node&t) const {return {x-t.x,y-t.y};}
}p[N],o;
int js(int x) {
    return x>n?1:x;
}
ll dis(node a,node b) {
    ll dx=a.x-b.x,dy=a.y-b.y;
    return dx*dx+dy*dy;
}
ll cross(node a,node b) {
    return a.x*b.y-b.x*a.y;
}
ll pow_(ll x) {return x*x;}
void solve() {
    cin>>n;
    cin>>rx>>ry>>r;
    o=node(rx,ry);
    for(int i=1;i<=n;i++) {
        cin>>p[i].x>>p[i].y;
    }
    ll ans=0,mx=0;
    for(int i=1,j=i+1;i<=n;i++) {
        int id=js(j+1);
        while(cross(p[id]-p[i],o-p[i])>=-eps && 1.0*cross(p[id]-p[i],o-p[i])>=r*sqrt(dis(p[id],p[i]))) {
            ll s=cross(p[j]-p[i],p[id]-p[i]);
            ans+=s,j=id,id=js(j+1);
            mx=max(mx,ans);
        }
        int tmp=js(i+1);
        ans-=cross(p[tmp]-p[i],p[j]-p[i]);
    }
    cout<<mx<<endl;
}
int main() {
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int T;
    cin>>T;
    while(T--) 
    solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3708kb

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: 0ms
memory: 3596kb

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'