This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,a,b;
cin >> n;
vector<pair<int,int>> tab(0);
for (int i=0; i<n; i++){
cin >> a >> b;
tab.push_back({a,b});
}
sort(tab.begin(),tab.end());
int wynik = 0;
for (int i=0; i<n; i++){
int akt_wynik = 0;
int pop = tab[i].first;
for (int j=i; j<n; j++){
akt_wynik = akt_wynik-(tab[i].first-pop)+tab[i].second;
pop = tab[j].first;
wynik = max(wynik,akt_wynik);
}
}
cout << wynik << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |