QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#115227#5904. Twirling Towards Freedomzhouhuanyi10 8ms3812kbC++111.0kb2023-06-25 10:37:282023-06-25 10:37:30

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-25 10:37:30]
  • 评测
  • 测评结果:10
  • 用时:8ms
  • 内存:3812kb
  • [2023-06-25 10:37:28]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cmath>
#define N 5000
using namespace std;
int read()
{
    char c=0;
    int sum=0,f=1;
    while (c!='-'&&(c<'0'||c>'9')) c=getchar();
    if (c=='-') c=getchar(),f=-1;
    while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
    return sum*f;
}
struct reads
{
    int x,y;
};
reads st[N+1];
int T,n,m,sm;
int main()
{
    int x,y;
    long long sx,sy;
    double ans;
    T=read();
    for (int qt=1;qt<=T;++qt)
    {
	n=read(),m=read(),ans=0;
	for (int i=1;i<=n;++i) x=read(),y=read(),st[i].x=x-y,st[i].y=x+y;
	for (int i=1;i<=n;++i)
	    for (int j=1;j<=n;++j)
		for (int k=1;k<=n;++k)
		    for (int t=1;t<=n;++t)
			for (int w=0;w<=min(3,m);++w)
			{
			    sm=m-w;
			    sx=1ll*st[i].x*((sm+3)>>2)+1ll*st[j].y*((sm+2)>>2)-1ll*st[k].x*((sm+1)>>2)-1ll*st[t].y*(sm>>2);
			    sy=1ll*st[i].y*((sm+3)>>2)-1ll*st[j].x*((sm+2)>>2)-1ll*st[k].y*((sm+1)>>2)+1ll*st[t].x*(sm>>2);
			    ans=max(ans,sqrt(sx*sx+sy*sy));
			}
	printf("Case #%d: %0.10lf\n",qt,ans);
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 8ms
memory: 3812kb

input:

100
4
1
-2 4
1 -2
4 1
0 2
1
4
-5 0
2
5
-1 1
-2 2
10
8
-842 -60
148 -967
327 -600
-546 -346
-196 -267
-833 -156
334 -791
974 -382
-499 -785
519 -657
10
7
444 786
-313 649
-377 954
-872 316
505 714
678 170
40 -971
-290 -649
-824 -797
357 -653
10
9
-384 -28
267 -243
507 -628
-189 -656
373 -879
-115 -81...

output:

Case #1: 6.3245553203
Case #2: 10.0000000000
Case #3: 6.3245553203
Case #4: 8072.6630054772
Case #5: 9582.0846374889
Case #6: 9520.9500576361
Case #7: 3136.8787034248
Case #8: 9405.6161945935
Case #9: 9809.6108995209
Case #10: 8356.3092331483
Case #11: 8863.7475144546
Case #12: 10066.9729313235
Case...

result:

ok correct! (100 test cases)

Subtask #2:

score: 0
Time Limit Exceeded

Test #2:

score: 0
Time Limit Exceeded

input:

100
200
59153573
81 -81
-252 252
864 -864
-691 691
-599 599
-520 520
-835 835
334 -334
259 -259
-469 469
374 -374
-36 36
932 -932
-518 518
-882 882
-150 150
-392 392
29 -29
8 -8
-259 259
192 -192
-863 863
-88 88
-219 219
-118 118
485 -485
-953 953
-980 980
-14 14
433 -433
-672 672
352 -352
196 -196
...

output:


result: