Submission #240282

# Submission time Handle Problem Language Result Execution time Memory
240282 2020-06-19T06:27:42 Z rzh Bulldozer (JOI17_bulldozer) C++17
0 / 100
5 ms 384 KB
#include <bits/stdc++.h>
#include <iostream>
 
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll T = 1;
	//cin >> T;
	while (T--){
		ll n;
		cin >> n;
		vector<pair<ll,ll>> a;
		vector<ll> b;
		for (int i = 0; i<n; i++){
			ll x,y,w;
			cin >> x >> y >> w;
			a.push_back({x,w});
		}
		sort(a.begin(),a.end());
		b.push_back(0);
		for (int i = 0; i<n; i++){
			b.push_back(a[i].second);
		}
		for (int i = 1; i<n+1; i++){
			b[i] = b[i] + b[i-1];
		}
		for (auto x: b) cout << x << " ";
		cout << endl;
		ll cur_min = 0;
		ll ans = 0;
		for (int i = 0; i<n+1; i++){
			if (b[i] < cur_min) cur_min = b[i];
			ans = max(ans, b[i] - cur_min);
		}
		cout << ans << endl;
	}	
}	

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