QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#115721#5904. Twirling Towards FreedomZesty_Fox0 1324ms4604kbC++202.4kb2023-06-26 17:06:182023-06-26 17:06:47

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-26 17:06:47]
  • 评测
  • 测评结果:0
  • 用时:1324ms
  • 内存:4604kb
  • [2023-06-26 17:06:18]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using u32=unsigned int;
using i64=long long;
using u64=unsigned long long;
using db=double;
using vi=vector<int>;
using pii=pair<int,int>;

template<typename T>
T read(){
    T x=0,f=0;char ch=getchar();
    while(!isdigit(ch)) f|=(ch=='-'),ch=getchar();
    while(isdigit(ch)) x=x*10+(ch-'0'),ch=getchar();
    return f?-x:x;
}

#define rdi read<int>
#define rdi64 read<i64>
#define fi first
#define se second
#define pb push_back

const int N=5010,INF=0x3f3f3f3f,MX=2000;

int n,m;
pii p[N];

template<typename T>
void ckmin(T &a,T b){
    if(a>b) a=b;
}
template<typename T>
void ckmax(T &a,T b){
    if(a<b) a=b;
}

void solve(int tid){
    n=rdi(),m=rdi();
    for(int i=1;i<=n;i++){
        int x=rdi(),y=rdi();
        p[i]={x-y,x+y};
    }
    static int f[5][(MX+1)*8][2];
    const int DT=MX*4;
    f[0][0][0]=f[0][0][1]=0;
    for(int i=1;i<=4;i++){
        for(int k=-MX*i;k<=MX*i;k++)
            f[i][k+DT][0]=INF,f[i][k+DT][1]=-INF;
        for(int j=1;j<=n;j++){
            int v1,v2;
            if(i==1) v1=p[j].fi,v2=p[j].se;
            else if(i==2) v1=p[j].se,v2=-p[j].fi;
            else if(i==3) v1=-p[j].fi,v2=-p[j].se;
            else if(i==4) v1=-p[j].se,v2=p[j].fi;
            for(int k=-MX*(i-1);k<=MX*(i-1);k++){
                if(f[i-1][k+DT][0]==INF) continue;
                ckmin(f[i][k+v1+DT][0],f[i-1][k+DT][0]+v2);
                ckmax(f[i][k+v1+DT][1],f[i-1][k+DT][1]+v2);
            }
        }
    }

    auto dis2 = [&](i64 x,i64 y){
        return (db)x*x+(db)y*y;
    };

    db ans=0;
    vector<pii> vec[5];
    for(int i=1;i<=4;i++)
        for(int x=-MX*i;x<=MX*i;x++){
            if(f[i][x+DT][0]==INF) continue;
            for(auto y:f[i][x+DT]) vec[i].pb({x,y});
        }
    for(int i=1;i<=min(4,m);i++){
        for(auto cur:vec[i]){
            int x=cur.fi,y=cur.se,mul=(i!=4?1:m/4);
            ans=max(ans,dis2((i64)x*mul,(i64)y*mul));
            // int c=(m-i)/4;
            // for(auto cur1:vec[4])
            //     ans=max(ans,dis2(x+(i64)c*cur1.fi,y+(i64)c*cur1.se));
        }
    }
    printf("Case #%d: %.10lf\n",tid,sqrt(ans));
}

int main(){
#ifdef LOCAL
    freopen("1.in","r",stdin);
    freopen("1.out","w",stdout);
#endif
    int T=rdi();
    for(int i=1;i<=T;i++) solve(i);
    return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 32ms
memory: 4080kb

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: 5.6568542495
Case #4: 8072.6630054772
Case #5: 5348.9625162269
Case #6: 8060.9761195528
Case #7: 2139.9971962598
Case #8: 8019.5386400964
Case #9: 5188.6585935095
Case #10: 5539.8173255081
Case #11: 4676.1372948193
Case #12: 10066.9729313235
Case...

result:

wrong answer read 5.656854249500 but expected 6.324555320300 (test case 3)

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 1324ms
memory: 4604kb

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:

Case #1: 82359119136.5425567627
Case #2: 84510623363.7489929199
Case #3: 70661048251.1457366943
Case #4: 109064876517.1728057861
Case #5: 31887457567.9850463867
Case #6: 44597031679.0797042847
Case #7: 16108034814.1949920654
Case #8: 88820696748.1242065430
Case #9: 38768572469.0563278198
Case #10: 2...

result:

wrong answer read 880883456.286327481270 but expected 880886964.963349938393 (test case 14)