QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#446264 | #8524. Weather Forecast | rustiebeats | WA | 0ms | 3920kb | C++17 | 1.9kb | 2024-06-17 05:00:11 | 2024-06-17 05:00:13 |
Judging History
answer
#define _DEB123UG
// #include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
// using namespace atcoder;
#define endl "\n"
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<int> vi;
typedef vector<pii> vii;
const long double pi = acos(-1.0);
const int INF = 1987654331;
const ll LLINF = 1e18;
const double eps = 1e-9;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
////////////////////////
// #ifndef ONLINE_JUDGE
// #include "template.cpp"
// #else
// #define debug(...)
// #define debugArr(...)
// #endif
////////////////////////
// ll dist[52][52][2502];
ld arr[202020];
ld psum[202020];
int main(){
#ifdef _DEBUG
freopen ("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(NULL);
int N,K;cin>>N>>K;
for(int i=1;i<=N;i++)cin>>arr[i];
ld lo=0.0;
ld hi=1000.0;
int it=0;
while(it++<=100){
ld mid=(lo+hi)/2;
vector<ld> p;
ld s=0;
for(int i=1;i<=N;i++){
// if(i==1)p.push_back(arr[1]-mid);
// else p.push_back(p.back()+(arr[i]-mid));
s+=arr[i];
p.push_back(s-i*mid);
}
vector<ld> lis;
for(auto v:p){
if(v<0)continue;
if(lis.empty()||lis.back()<=v)lis.push_back(v);
else *lower_bound(lis.begin(),lis.end(),v)=v;
}
cout<<mid<<" "<<lis.size()<<endl;
if(lis.size()>=K+1)lo=mid;
else hi=mid;
}
cout<<fixed;
cout<<setprecision(12);
cout<<lo<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3920kb
input:
7 3 1 3 1 2 2 2 1
output:
500 0 250 0 125 0 62.5 0 31.25 0 15.625 0 7.8125 0 3.90625 0 1.95312 1 0.976562 7 1.46484 4 1.70898 3 1.58691 4 1.64795 4 1.67847 3 1.66321 4 1.67084 3 1.66702 3 1.66512 4 1.66607 4 1.66655 4 1.66678 3 1.66667 4 1.66672 3 1.66669 3 1.66668 3 1.66667 3 1.66667 3 1.66667 3 1.66667 4 1.66667 4 1.66667 ...
result:
wrong answer 1st numbers differ - expected: '1.66667', found: '500.00000', error = '498.33333'