QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#432878#8027. Sky Gardenwsc2008#AC ✓126ms3932kbC++141.4kb2024-06-07 19:31:312024-06-07 19:31:32

Judging History

This is the latest submission verdict.

  • [2024-06-07 19:31:32]
  • Judged
  • Verdict: AC
  • Time: 126ms
  • Memory: 3932kb
  • [2024-06-07 19:31:31]
  • Submitted

answer

#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pii pair<ll,ll>
#define rep(i,a,b) for(ll i=(a);i<=(b);++i)
#define per(i,a,b) for(ll i=(a);i>=(b);--i)
using namespace std;
bool Mbe;
ll read(){
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void write(ll x){
    if(x<0)putchar('-'),x=-x;
    if(x>9)write(x/10);
    putchar(x%10+'0');
}
const ll N=1009;
const ld pi=acos(-1);
ll n,m,cnt[N];
ld ans;
ll Dis(ll x,ll y){
    if(x<y)return min(y-x,2*m-y+x);
    return min(x-y,2*m+y-x);
}
bool Med;
int main(){
    cerr<<fabs(&Med-&Mbe)/1048576.0<<"MB\n";
    n=read(),m=read();
    //直线上
    rep(i,1,2*n+1){
        rep(j,i+1,2*n+1)ans+=abs(i-j);
    }
    if(m==1){
        rep(i,1,2*n+1)ans-=abs(n+1-i);
    }
    ans*=m;
    //同一个圆上
    rep(i,1,2*m){
        rep(j,i+1,2*m){
            if(i==j||abs(i-j)==m)continue;
            cnt[Dis(i,j)]++;
        }
    }
    rep(i,1,n){
        rep(j,1,m){
            ans+=cnt[j]*min(pi*j*i*1.0/m,(ld)i*2.0);
        }
    }
    cnt[0]+=2*m;
    rep(i,1,m)cnt[i]*=2;
    //不同圆之间
    rep(i,1,n){
        rep(j,i+1,n){
            rep(k,1,m)ans+=cnt[k]*(j-i+min(pi*k*i*1.0/m,(ld)i*2.0));
        }
    }
    cout<<fixed<<setprecision(10)<<ans;
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 2

output:

14.2831853072

result:

ok found '14.2831853', expected '14.2831853', error '0.0000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

1 1

output:

2.0000000000

result:

ok found '2.0000000', expected '2.0000000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3816kb

input:

500 1

output:

166916500.0000000000

result:

ok found '166916500.0000000', expected '166916500.0000000', error '0.0000000'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3840kb

input:

500 2

output:

763585309.5613224949

result:

ok found '763585309.5613225', expected '763585309.5613225', error '0.0000000'

Test #5:

score: 0
Accepted
time: 121ms
memory: 3896kb

input:

500 499

output:

49125277129819.4042739868

result:

ok found '49125277129819.4062500', expected '49125277129819.2734375', error '0.0000000'

Test #6:

score: 0
Accepted
time: 126ms
memory: 3888kb

input:

500 500

output:

49322369986259.9059066772

result:

ok found '49322369986259.9062500', expected '49322369986259.6953125', error '0.0000000'

Test #7:

score: 0
Accepted
time: 9ms
memory: 3696kb

input:

252 139

output:

488838606007.1793870926

result:

ok found '488838606007.1793823', expected '488838606007.1795654', error '0.0000000'

Test #8:

score: 0
Accepted
time: 5ms
memory: 3892kb

input:

96 359

output:

181277190205.0370913893

result:

ok found '181277190205.0370789', expected '181277190205.0371094', error '0.0000000'

Test #9:

score: 0
Accepted
time: 29ms
memory: 3896kb

input:

237 487

output:

4992630041184.2004518509

result:

ok found '4992630041184.2001953', expected '4992630041184.1953125', error '0.0000000'

Test #10:

score: 0
Accepted
time: 4ms
memory: 3932kb

input:

81 411

output:

142953582310.2773344517

result:

ok found '142953582310.2773438', expected '142953582310.2773743', error '0.0000000'

Test #11:

score: 0
Accepted
time: 2ms
memory: 3824kb

input:

221 39

output:

25968641931.5297115538

result:

ok found '25968641931.5297127', expected '25968641931.5297089', error '0.0000000'

Test #12:

score: 0
Accepted
time: 20ms
memory: 3844kb

input:

270 259

output:

2087014641700.0225390196

result:

ok found '2087014641700.0224609', expected '2087014641700.0227051', error '0.0000000'

Test #13:

score: 0
Accepted
time: 70ms
memory: 3888kb

input:

422 387

output:

17770193032349.6795902252

result:

ok found '17770193032349.6796875', expected '17770193032349.6250000', error '0.0000000'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

63 15

output:

89852047.5085170570

result:

ok found '89852047.5085171', expected '89852047.5085171', error '0.0000000'

Test #15:

score: 0
Accepted
time: 73ms
memory: 3852kb

input:

407 439

output:

20515296102923.2809143066

result:

ok found '20515296102923.2812500', expected '20515296102923.2070312', error '0.0000000'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

18 18

output:

3123573.6956475553

result:

ok found '3123573.6956476', expected '3123573.6956476', error '0.0000000'

Test #17:

score: 0
Accepted
time: 5ms
memory: 3832kb

input:

171 146

output:

168786179167.0193163604

result:

ok found '168786179167.0193176', expected '168786179167.0194092', error '0.0000000'

Test #18:

score: 0
Accepted
time: 8ms
memory: 3756kb

input:

311 70

output:

232875509505.2748494893

result:

ok found '232875509505.2748413', expected '232875509505.2748413', error '0.0000000'

Test #19:

score: 0
Accepted
time: 14ms
memory: 3888kb

input:

155 494

output:

1439825967582.9990919828

result:

ok found '1439825967582.9990234', expected '1439825967582.9992676', error '0.0000000'

Test #20:

score: 0
Accepted
time: 19ms
memory: 3816kb

input:

204 418

output:

2347066265474.4890642166

result:

ok found '2347066265474.4892578', expected '2347066265474.4873047', error '0.0000000'

Test #21:

score: 0
Accepted
time: 6ms
memory: 3868kb

input:

344 46

output:

136054690372.2715086341

result:

ok found '136054690372.2715149', expected '136054690372.2714844', error '0.0000000'

Test #22:

score: 0
Accepted
time: 3ms
memory: 3752kb

input:

188 174

output:

318429902145.0419947803

result:

ok found '318429902145.0419922', expected '318429902145.0420532', error '0.0000000'

Test #23:

score: 0
Accepted
time: 9ms
memory: 3844kb

input:

137 394

output:

632896487876.0316071510

result:

ok found '632896487876.0316162', expected '632896487876.0313721', error '0.0000000'

Test #24:

score: 0
Accepted
time: 6ms
memory: 3884kb

input:

481 22

output:

85020954588.2031013817

result:

ok found '85020954588.2030945', expected '85020954588.2031097', error '0.0000000'

Test #25:

score: 0
Accepted
time: 2ms
memory: 3848kb

input:

30 446

output:

8705279441.3520847624

result:

ok found '8705279441.3520851', expected '8705279441.3520851', error '0.0000000'

Test #26:

score: 0
Accepted
time: 20ms
memory: 3844kb

input:

204 440

output:

2600626525627.9575912952

result:

ok found '2600626525627.9575195', expected '2600626525627.9575195', error '0.0000000'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3788kb

input:

2 3

output:

175.4159265359

result:

ok found '175.4159265', expected '175.4159265', error '0.0000000'

Extra Test:

score: 0
Extra Test Passed