Submission #905781


Source Code Expand

/*
 * 16-10-1_AGC005_B.cpp
 *
 *  Created on: 2016/10/01
 *      Author: ryoma
 */

#include<iostream>
#include<algorithm>


using namespace std;

int N,a[200001];
long long ans;
int main(){
	cin >> N;
	for(int i=0;i<N;i++)
		cin >> a[i];
	for(int l=0;l<N;l++){
		int amin = a[l];
		for(int r=l+1;r<N;r++){
			amin =min(amin,a[r]);
			ans += amin;
		}
	}
	cout << ans+N*(N+1)/2 << endl;
	return 0;
}

Submission Info

Submission Time
Task B - Minimum Sum
User hashiryo
Language C++14 (GCC 5.4.1)
Score 0
Code Size 429 Byte
Status TLE
Exec Time 2102 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 7
TLE × 6
Set Name Test Cases
Sample example0, example1, example2
All corner0, corner1, corner2, corner3, example0, example1, example2, maxrand0, maxrand1, maxrand2, rand0, rand1, rand2
Case Name Status Exec Time Memory
corner0 TLE 2102 ms 1024 KB
corner1 TLE 2102 ms 1024 KB
corner2 AC 3 ms 256 KB
corner3 TLE 2102 ms 1024 KB
example0 AC 3 ms 256 KB
example1 AC 3 ms 256 KB
example2 AC 3 ms 256 KB
maxrand0 TLE 2102 ms 1024 KB
maxrand1 TLE 2102 ms 1024 KB
maxrand2 TLE 2102 ms 1024 KB
rand0 AC 3 ms 384 KB
rand1 AC 3 ms 256 KB
rand2 AC 3 ms 256 KB