Submission #760454


Source Code Expand

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
	int n;
	cin>>n;
	vi a(n),b(n),c;
	rep(i,n)cin>>a[i];
	rep(i,n)cin>>b[i];
	c=b;
	rep(i,n-1)c[i+1]=max(c[i],c[i+1]);
	int out=n*b[0],t=0,hav=0;
	rep(i,n){
		if(hav+a[t]<0)hav+=b[t];
		else{
			hav+=a[t];
			t++;
			out=max(out,hav+(n-i-1)*c[t]);
		}
	}
	cout<<out<<endl;
}

Submission Info

Submission Time
Task D - 高橋君の旅行
User ixmel_rd
Language C++ (GCC 4.9.2)
Score 0
Code Size 868 Byte
Status WA
Exec Time 198 ms
Memory 2160 KB

Judge Result

Set Name Small All
Score / Max Score 0 / 3 0 / 197
Status
AC × 11
WA × 2
AC × 15
WA × 34
Set Name Test Cases
Small 00_small_sample_00.txt, 00_small_sample_01.txt, 00_small_sample_02.txt, 00_small_sample_03.txt, 10_small_01.txt, 10_small_02.txt, 10_small_03.txt, 10_small_04.txt, 10_small_05.txt, 10_small_06.txt, 90_small_teuchi_00.txt, 90_small_teuchi_01.txt, 90_small_teuchi_02.txt
All 00_small_sample_00.txt, 00_small_sample_01.txt, 00_small_sample_02.txt, 00_small_sample_03.txt, 10_small_01.txt, 10_small_02.txt, 10_small_03.txt, 10_small_04.txt, 10_small_05.txt, 10_small_06.txt, 20_large_01.txt, 20_large_02.txt, 20_large_03.txt, 20_large_04.txt, 20_large_05.txt, 20_large_06.txt, 20_large_07.txt, 20_large_08.txt, 20_large_09.txt, 20_large_10.txt, 20_large_11.txt, 20_large_12.txt, 20_large_13.txt, 20_large_14.txt, 20_large_15.txt, 20_large_16.txt, 20_large_17.txt, 20_large_18.txt, 20_large_19.txt, 20_large_20.txt, 20_large_21.txt, 20_large_22.txt, 20_large_23.txt, 20_large_24.txt, 20_large_25.txt, 20_large_26.txt, 20_large_27.txt, 20_large_28.txt, 20_large_29.txt, 20_large_30.txt, 30_run_through_01.txt, 70_maximum_01.txt, 80_hand_01.txt, 80_hand_02.txt, 80_hand_03.txt, 80_hand_04.txt, 90_small_teuchi_00.txt, 90_small_teuchi_01.txt, 90_small_teuchi_02.txt
Case Name Status Exec Time Memory
00_small_sample_00.txt AC 31 ms 996 KB
00_small_sample_01.txt AC 27 ms 1048 KB
00_small_sample_02.txt AC 27 ms 1052 KB
00_small_sample_03.txt AC 27 ms 920 KB
10_small_01.txt WA 27 ms 916 KB
10_small_02.txt AC 26 ms 920 KB
10_small_03.txt AC 27 ms 1048 KB
10_small_04.txt AC 27 ms 932 KB
10_small_05.txt AC 31 ms 1048 KB
10_small_06.txt AC 26 ms 1044 KB
20_large_01.txt WA 156 ms 2088 KB
20_large_02.txt WA 176 ms 2084 KB
20_large_03.txt WA 175 ms 2088 KB
20_large_04.txt WA 158 ms 2084 KB
20_large_05.txt WA 184 ms 2064 KB
20_large_06.txt WA 198 ms 2032 KB
20_large_07.txt WA 153 ms 2084 KB
20_large_08.txt WA 174 ms 2072 KB
20_large_09.txt WA 180 ms 2128 KB
20_large_10.txt WA 152 ms 2084 KB
20_large_11.txt WA 175 ms 2084 KB
20_large_12.txt WA 181 ms 2148 KB
20_large_13.txt WA 152 ms 2088 KB
20_large_14.txt WA 173 ms 2084 KB
20_large_15.txt WA 155 ms 2084 KB
20_large_16.txt WA 136 ms 2088 KB
20_large_17.txt WA 154 ms 2072 KB
20_large_18.txt WA 155 ms 2080 KB
20_large_19.txt WA 150 ms 2132 KB
20_large_20.txt WA 170 ms 2084 KB
20_large_21.txt WA 169 ms 2068 KB
20_large_22.txt WA 128 ms 2088 KB
20_large_23.txt WA 152 ms 2084 KB
20_large_24.txt WA 149 ms 2084 KB
20_large_25.txt WA 148 ms 2088 KB
20_large_26.txt WA 171 ms 2076 KB
20_large_27.txt WA 168 ms 2088 KB
20_large_28.txt WA 151 ms 2088 KB
20_large_29.txt WA 168 ms 2084 KB
20_large_30.txt WA 170 ms 2076 KB
30_run_through_01.txt WA 164 ms 2072 KB
70_maximum_01.txt WA 180 ms 2068 KB
80_hand_01.txt AC 87 ms 2160 KB
80_hand_02.txt AC 85 ms 2068 KB
80_hand_03.txt AC 85 ms 2084 KB
80_hand_04.txt AC 84 ms 2080 KB
90_small_teuchi_00.txt AC 26 ms 1048 KB
90_small_teuchi_01.txt WA 29 ms 984 KB
90_small_teuchi_02.txt AC 26 ms 1044 KB