# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
913876 |
2024-01-20T11:27:19 Z |
dm2010 |
Stove (JOI18_stove) |
C++14 |
|
0 ms |
344 KB |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a,maxx=0;
cin >> a;
pair <long long, long long> p[a];
for (int i=0;i<a;i++)
cin >> p[i].first >> p[i].second;
sort(p,p+a);
long long x[a];
x[0]=p[0].second;
for (int i=1;i<a;i++) {
x[i]=x[i-1]+p[i].second;
}
long long mx = p[0].first;
for(int j=0;j<a;j++) {
//x[j]-p[j].first + (p[i].first - x[i - 1])
maxx = max(maxx, x[j]-p[j].first + mx);
mx = max(mx, p[j].first - x[j - 1]);
}
cout << maxx <<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |