Submission #210226

# Submission time Handle Problem Language Result Execution time Memory
210226 2020-03-16T22:42:59 Z super_j6 Bigger segments (IZhO19_segments) C++14
0 / 100
5 ms 376 KB
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define endl '\n'
#define pi pair<long long, long long>
#define f first
#define s second
 
const int maxn = 500000;
int n;
int a[maxn];
pi dp[maxn];
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n;
	
	for(int i = 1; i <= n; i++) cin >> a[i];
	
	for(int i = 1; i <= n; i++){
		for(long long j = i - 1, s = a[i]; j >= 0; j--){
			if(dp[j].f >= dp[i].f && s >= dp[j].s) dp[i] = {dp[j].f + 1, s};
			s += a[j];
		}
		cout << dp[i].f << " " << dp[i].s << endl;
	}
	
	cout << dp[n].f << endl;
 
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -