QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#842099#9966. High Jumpucup-team6274#WA 1ms5960kbC++141.8kb2025-01-04 10:15:592025-01-04 10:16:05

Judging History

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

  • [2025-01-04 10:16:05]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5960kb
  • [2025-01-04 10:15:59]
  • 提交

answer

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
bool Mbg;
using namespace std;
#define vec vector
#define pb push_back
#define eb emplace_back
#define siz(vec) ((int)(vec).size())
#define all(vec) (vec).begin(),(vec).end()
template<class T>
void operator +=(vec<T> &a,T b){a.push_back(b);}
template<class T>
void operator --(vec<T> &a){a.pop_back();}
#define pii pair<int,int>
#define x first
#define y second
#define mp make_pair
#define exc(exp) if(exp)continue;
#define stop(exp) if(exp)break;
#define ret(exp) if(exp)return;
#define deb(var) cerr<<#var<<'='<<(var)<<"; "
#define debl(var) cerr<<#var<<'='<<(var)<<";\n"
#define ins insert
#define era erase
#define lb lower_bound
#define ub upper_bound
#define int long long
#define inf (long long)(1e18)
template<class T>
bool Min(T &x,T y){return x>y?x=y,1:0;}
template<class T>
bool Max(T &x,T y){return x<y?x=y,1:0;}
const int mod=1e9+7;
void Add(int &x,int y){x=x+y<mod?x+y:x+y-mod;}
void Dec(int &x,int y){x=x>=y?x-y:x-y+mod;}
int fpm(int x,int y){
    int ans=1;for(;y;y>>=1,(x*=x)%=mod)if(y&1)(ans*=x)%=mod;return ans;
}

int n;
double p[500010];

double va[500010];
void work(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>p[i];
    }
    for(int i=n,j=n+1;~i;i--){
        va[i]=p[j]*(j-i+va[j]);
        while(j>i+1&&p[j-1]*(j-1-i+va[j-1])>=va[i]){
            j--;
            va[i]=p[j]*(j-i+va[j]);
        }
    }
    cout<<fixed<<setprecision(12)<<va[0]<<'\n';
}
bool Med;
signed main(){
    ios::sync_with_stdio(0),
    cin.tie(0),cout.tie(0);
    int T=1;while(T--)work();
    // cerr<<"Time: "<<clock()<<" ms;\n";
    // cerr<<"Memory: "<<abs(&Med-&Mbg)/1024.0/1024.0<<" MiB.\n";
}
/*
- CONTINUE, NON-STOPPING, FOR THE FAITH
- START TYPING IF YOU DON'T KNOW WHAT TO DO
- STOP TYPING IF YOU DON'T KNOW WHAT YOU'RE DOING
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5896kb

input:

5
0.9 0.85 0.6 0.456000 0.000000017

output:

2.475200006589

result:

ok found '2.4752000', expected '2.4752000', error '0.0000000'

Test #2:

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

input:

1
0.000000001

output:

0.000000001000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #3:

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

input:

2
0.828496829 0.645649353

output:

1.363415270606

result:

ok found '1.3634153', expected '1.3634153', error '0.0000000'

Test #4:

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

input:

3
0.551197930 0.393255768 0.207104323

output:

0.867956505597

result:

ok found '0.8679565', expected '0.8679565', error '0.0000000'

Test #5:

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

input:

4
0.795361966 0.464795612 0.331129862 0.063526593

output:

1.338829040057

result:

ok found '1.3388290', expected '1.3388290', error '0.0000000'

Test #6:

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

input:

5
0.895888800 0.546833708 0.412641158 0.222811308 0.111288348

output:

1.726785711701

result:

ok found '1.7267857', expected '1.7267857', error '0.0000000'

Test #7:

score: -100
Wrong Answer
time: 1ms
memory: 5952kb

input:

6
0.980827003 0.951772494 0.903718587 0.460647740 0.409951573 0.403255978

output:

2.419535868000

result:

wrong answer 1st numbers differ - expected: '3.8259383', found: '2.4195359', error = '0.3675967'