Submission #102704

# Submission time Handle Problem Language Result Execution time Memory
102704 2019-03-27T05:28:56 Z Sayat Divide and conquer (IZhO14_divide) C++14
17 / 100
72 ms 768 KB
#include <bits/stdc++.h>
using namespace std;

int a[101010],b[101010],c[101010];
int ans[101010],cnt[101010];
int n,mx;

int main () {
cin>>n;
for (int i=1;i<=n;i++){
	cin>>a[i]>>b[i]>>c[i];
    ans[i]=ans[i-1]+b[i];
    cnt[i]=cnt[i-1]+c[i];
}
for (int i=1;i<=n;i++){
	for (int j=i;j<=n;j++){
		int q=a[j]-a[i];
		int w=cnt[j]-cnt[i-1];
		if (q<=w) mx=max(mx,ans[j]-ans[i-1]);
		}
}
cout<<mx;

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 4 ms 392 KB Output is correct
5 Incorrect 4 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 512 KB Output is correct
2 Correct 68 ms 768 KB Output is correct
3 Incorrect 72 ms 768 KB Output isn't correct
4 Halted 0 ms 0 KB -