Submission #1982561

Source Code Expand

Copy
```#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
int i,j;
int n;
cin>>n;
vi t(n),v(n);
rep(i,n)cin>>t[i],t[i]*=2;
rep(i,n)cin>>v[i];
rep(i,n-1)t[i+1]+=t[i];

int max_t=t[n-1];
vector<double> v1(max_t+1,0.0),v2(max_t+1,0.0);
int cnt=0;
rep(i,max_t){
if(i==t[cnt])cnt++;
v1[i+1]=min((double)v[cnt],v1[i]+0.5);
}
for(;i>0;i--){
if(i==t[cnt-1])cnt--;
v2[i-1]=min((double)v[cnt],v2[i]+0.5);
}

double ans=0;
rep(i,max_t+1)ans+=min(v1[i],v2[i]);
cout<<shosu(5)<<ans/2<<endl;
}
```

#### Submission Info

Submission Time 2018-01-15 17:57:55+0900 D - AtCoder Express rika0384 C++14 (GCC 5.4.1) 400 1179 Byte AC 2 ms 896 KB

#### Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 s1.txt, s2.txt, s3.txt, s4.txt, s5.txt
All 400 / 400 in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in25.txt, in26.txt, in27.txt, in28.txt, in29.txt, in30.txt, in31.txt, in32.txt, in33.txt, in34.txt, in35.txt, s1.txt, s2.txt, s3.txt, s4.txt, s5.txt
Case Name Status Exec Time Memory
in01.txt 1 ms 256 KB
in02.txt 1 ms 256 KB
in03.txt 1 ms 256 KB
in04.txt 1 ms 256 KB
in05.txt 2 ms 640 KB
in06.txt 2 ms 512 KB
in07.txt 1 ms 512 KB
in08.txt 1 ms 512 KB
in09.txt 1 ms 512 KB
in10.txt 1 ms 512 KB
in11.txt 2 ms 640 KB
in12.txt 1 ms 256 KB
in13.txt 1 ms 256 KB
in14.txt 1 ms 256 KB
in15.txt 1 ms 256 KB
in16.txt 1 ms 256 KB
in17.txt 1 ms 256 KB
in18.txt 1 ms 256 KB
in19.txt 1 ms 256 KB
in20.txt 1 ms 512 KB
in21.txt 1 ms 512 KB
in22.txt 1 ms 512 KB
in23.txt 1 ms 256 KB
in24.txt 2 ms 896 KB
in25.txt 2 ms 896 KB
in26.txt 1 ms 640 KB
in27.txt 1 ms 512 KB
in28.txt 1 ms 256 KB
in29.txt 1 ms 256 KB
in30.txt 1 ms 256 KB
in31.txt 2 ms 512 KB
in32.txt 1 ms 512 KB
in33.txt 1 ms 512 KB
in34.txt 1 ms 256 KB
in35.txt 1 ms 256 KB
s1.txt 1 ms 256 KB
s2.txt 1 ms 256 KB
s3.txt 1 ms 256 KB
s4.txt 1 ms 256 KB
s5.txt 1 ms 256 KB