QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#663683 | #9434. Italian Cuisine | inoader | WA | 16ms | 3704kb | C++14 | 2.4kb | 2024-10-21 16:43:38 | 2024-10-21 16:43:38 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define x first
#define y second
#define endl '\n'
using namespace std;
const int N=1e6+10,INF=1e14,mod=998244353,M=2e5+10;
const double eps = 1e-8;
typedef pair<double,double> PII;
typedef pair<PII,int> PIII;
int gcd(int a,int b){
return b?gcd(b,a%b):a;
}
int qmi(int a,int k){
int res=1;
while(k){
if(k&1) res=res*a%mod;
a=a*a%mod;
k>>=1;
}
return res;
}
PII a[N];
PII operator-(PII t1,PII t2){
PII c={t1.x-t2.x,t1.y-t2.y};
return c;
}
PII operator+(PII t1,PII t2){
PII c={t1.x+t2.x,t1.y+t2.y};
return c;
}
int sign(double x){
if (fabs(x) < eps) return 0;
if (x < 0) return -1;
return 1;
}
double cross(PII t1,PII t2){return t1.x*t2.y-t1.y*t2.x;}
double dot(PII a,PII b){
return a.x * b.x + a.y * b.y;
}
double get_length(PII a){
return sqrt(dot(a, a));
}
double distance_to_line(PII p, PII a, PII b){
PII v1 = b - a, v2 = p - a;
return fabs(cross(v1, v2) / get_length(v1));
}
double dts(PII p, PII a, PII b){
if (a == b) return get_length(p - a);
PII v1 = b - a, v2 = p - a, v3 = p - b;
if (sign(dot(v1, v2)) < 0) return get_length(v2);
if (sign(dot(v1, v3)) > 0) return get_length(v3);
return distance_to_line(p, a, b);
}
bool check(double p1,double p2){
if(sign(p1-p2)>=0) return true;//那就是可以
return false;
}
bool check1(PII x1,PII x2,PII x3,PII nei){
if(cross(x2-x1,nei-x1)<=0)return false;
if(cross(x3-x2,nei-x2)<=0) return false;
if(cross(x1-x3,nei-x3)<=0) return false;
return true;
}
void slove(){
int n;cin>>n;
int cx,cy,rr;cin>>cx>>cy>>rr;
PII dian={cx,cy};
double cr=rr;
for(int i=1;i<=n;i++){
int c1,c2;cin>>c1>>c2;
a[i]={c1,c2};
}
int l=1,r=1;
double area=0;
double ans=0;
for(int i=1;i<=n;i++){
if(l+2<=r){
int p=r%n;if(!p) p=n;
area-=fabs(cross(a[i]-a[i-1],a[p]-a[i-1]));
}
l=i,r=max(r,l+1);
int p1=(r+1)%n;if(!p1) p1=n;
int p2=(r)%n;if(!p2) p2=n;
while(check(dts(dian,a[l],a[p1]),cr)&&!check1(a[l],a[p2],a[p1],dian)){
area+=fabs(cross(a[p1]-a[l],a[p2]-a[l]));
r++;
p1=(r+1)%n;if(!p1) p1=n;
p2=(r)%n;if(!p2) p2=n;
}
ans=max(ans,area);
}
ans+=eps;
int q=ans*1;
if(q>2e17) cout<<0<<endl;
else cout<<q<<endl;
}
signed main(){
ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
int T=1;
cin>>T;
while(T--) slove();
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3536kb
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: 0
Accepted
time: 0ms
memory: 3664kb
input:
1 6 0 0 499999993 197878055 -535013568 696616963 -535013568 696616963 40162440 696616963 499999993 -499999993 499999993 -499999993 -535013568
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 15ms
memory: 3704kb
input:
6666 19 -142 -128 26 -172 -74 -188 -86 -199 -157 -200 -172 -199 -186 -195 -200 -175 -197 -161 -188 -144 -177 -127 -162 -107 -144 -90 -126 -87 -116 -86 -104 -89 -97 -108 -86 -125 -80 -142 -74 -162 -72 16 -161 -161 17 -165 -190 -157 -196 -154 -197 -144 -200 -132 -200 -128 -191 -120 -172 -123 -163 -138...
output:
5093 3086 2539 668 3535 7421 4883 5711 5624 1034 2479 3920 4372 2044 4996 5070 2251 4382 4175 1489 1154 3231 4038 1631 5086 14444 1692 6066 687 1512 4849 5456 2757 8341 8557 8235 1013 5203 10853 6042 6300 4480 2303 2728 1739 2187 3385 4266 6322 909 4334 1518 948 5036 1449 2376 3180 4810 1443 1786 47...
result:
ok 6666 numbers
Test #4:
score: -100
Wrong Answer
time: 16ms
memory: 3700kb
input:
6660 19 -689502500 -712344644 121094647 -534017213 -493851833 -578925616 -506634533 -663335128 -540066520 -748890119 -585225068 -847722967 -641694086 -916653030 -716279342 -956235261 -766049951 -1000000000 -836145979 -963288744 -923225928 -948140134 -944751289 -920681768 -972760883 -872492254 -10000...
output:
117285633945667136 89094762176992144 84336379088082368 63629451600307520 193020267813347520 73921930794195232 59524748406448176 34419869321856820 0 185783506654647936 80463327658075808 156569165998743744 129550296314602336 157065066097450688 77819745596643472 40796197589680464 113949125425608640 889...
result:
wrong answer 1st numbers differ - expected: '117285633945667137', found: '117285633945667136'