QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#595525 | #9434. Italian Cuisine | ucup-team5075# | WA | 0ms | 3912kb | C++14 | 3.2kb | 2024-09-28 13:54:07 | 2024-09-28 13:54:08 |
Judging History
answer
//Linkwish's code
#include<bits/stdc++.h>
#define endl '\n'
#define si inline
#define fi first
#define se second
using namespace std;
// typedef long long ll;typedef __int128 li;typedef long double ld;
typedef long double ll;
typedef pair<int,int> pii;typedef pair<ll,ll> pll;
typedef const int ci;typedef const ll cl;ci iinf=INT_MAX;cl linf=LLONG_MAX;
template<typename T>si bool gmax(T &x,const T y){if(x<y)return x=y,1;return 0;}
template<typename T>si bool gmin(T &x,const T y){if(y<x)return x=y,1;return 0;}
namespace LinkWish{
ci N=200005;
int n;
struct point{
ll x,y;
// inline void print(){printf("(%.3lf,%.3lf)\n",x,y);}
point operator +(const point &t)const{return (point){x+t.x,y+t.y};}
point operator -(const point &t)const{return (point){x-t.x,y-t.y};}
point operator *(const ll &t)const{return (point){x*t,y*t};}
point operator /(const ll &t)const{return (point){x/t,y/t};}
ll operator |(const point &t)const{return x*t.x+y*t.y;}
ll operator &(const point &t)const{return x*t.y-y*t.x;}
};
inline ll dis(point x,point y){return sqrt((x.x-y.x)*(x.x-y.x)+(x.y-y.y)*(x.y-y.y));}
struct line{
point x,y;
inline line(){}
inline line(point xx,point yy){x=xx,y=yy;}
inline ll len(){return dis(x,y);}
};
inline point rot(point x,ll res){
ll sn=sin(res),cs=cos(res);
return (point){x.x*cs-x.y*sn,x.x*sn+x.y*cs};
}
inline bool online1(point x,line y){return ((y.x-x)&(y.y-x))==0;}
inline bool online2(point x,line y){return online1(x,y)&&(x.x-min(y.x.x,y.y.x))>=0&&(x.y-min(y.x.y,y.y.y))>=0&&(x.x-max(y.x.x,y.y.x))<=0&&(x.y-max(y.x.y,y.y.y))<=0;}
inline point met(line x,line y){
ll l=(x.y-x.x)&(y.x-x.x),r=(x.y-x.x)&(y.y-x.x);
return (y.y-y.x)*(l/(l-r))+y.x;
}
inline ll dis1(point x,line y){
// cerr<<"DIS "<<x.x<<' '<<x.y<<' '<<y.x.x<<' '<<y.x.y<<' '<<y.y.x<<' '<<y.y.y<<endl;
return abs((y.x-x)&(y.y-x))/y.len();
}
inline ll dis2(point x,line y){
if(((x-y.x)|(y.y-y.x))<=0||((x-y.y)|(y.x-y.y))<=0)return min(dis(x,y.x),dis(x,y.y));
return dis1(x,y);
}
si ll S(point x,point y,point z){
line L=line(y,z);
return L.len()*dis1(x,L);
}
point X,a[N];
ll R;
si ll Read(){int x;cin>>x;return x;}
si void solve(){
cin>>n;
X.x=Read(),X.y=Read(),R=Read();
for(int i=1;i<=n;i++)a[i].x=Read(),a[i].y=Read(),a[i+n]=a[i];
n*=2;
// cerr<<"X "<<X.x<<' '<<X.y<<' '<<R<<endl;
ll s=0,ans=0;
for(int i=1,j=1;i<=n;i++){
// cerr<<"IN "<<i<<' '<<j<<' '<<a[i].x<<' '<<a[i].y<<endl;
if(j<i-1)s+=S(a[j],a[i-1],a[i]);
// if(j<i)cerr<<"DIS "<<dis1(X,line(a[j],a[i]))<<endl;
while(j<i&&(dis1(X,line(a[j],a[i]))<R||((a[j]-a[i])&(X-a[i]))>0)){
// cerr<<"POP "<<((a[j]-a[i])&(X-a[i]))<<endl;
if(j<i-1)s-=S(a[j],a[j+1],a[i]);
j++;
}
// cerr<<"GOTS "<<i<<' '<<j<<' '<<s<<endl;
gmax(ans,s);
}
cout<<fixed<<setprecision(0)<<(ans+0.5)<<endl;
}
si void mian(){
int TT;cin>>TT;while(TT--)solve();
}
}
signed main(){
#ifndef ONLINE_JUDGE
assert(freopen("in.in","r",stdin));
// assert(freopen("out.out","w",stdout));
assert(freopen("out.err","w",stderr));
#endif
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
LinkWish::mian();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3912kb
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: 3908kb
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'