Submission #833864

# Submission time Handle Problem Language Result Execution time Memory
833864 2023-08-22T09:14:09 Z baqqon_ Divide and conquer (IZhO14_divide) C++17
0 / 100
0 ms 212 KB
#include<bits/stdc++.h>

using namespace std;
 
int main() 
{
    //freopen("divide.in", "r", stdin); 
    //freopen("divide.out", "w", stdout);
    int n;
    cin >> n;
    int x[n] , g[n] , e[n] ;
	for(int i=1; i<=n; i++){
		cin >> x[i] >> g[i] >> e[i];
	}
	int rud = g[1];
	int gold = g[1], energy = e[1];
	for(int i=2; i<=n; i++){
		int len = x[i] - x[i-1];
		if(len <= energy + e[i]){
			gold += g[i];
			energy += e[i] - len;
		}
		else{
			gold = g[i];
			energy = e[i];
		}
		rud = max(rud, gold);
	}
	cout << gold+1;
} 

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -