Submission #1066982

#TimeUsernameProblemLanguageResultExecution timeMemory
1066982SzymonKrzywdaArt Exhibition (JOI18_art)C++17
50 / 100
1064 ms20908 KiB
#include <bits/stdc++.h> using namespace std; int main() { long long n,a,b; cin >> n; vector<pair<long long, long long>> tab(0); for (int i=0; i<n; i++){ cin >> a >> b; tab.push_back({a,b}); } sort(tab.begin(),tab.end()); long long wynik = 0; for (int i=0; i<n; i++){ long long akt_wynik = 0; long long pop = tab[i].first; for (int j=i; j<n; j++){ //cout << tab[j].first << " " << pop << tab[j].second << " " << akt_wynik << " " << wynik << endl; akt_wynik = akt_wynik-(tab[j].first-pop)+tab[j].second; pop = tab[j].first; wynik = max(wynik,akt_wynik); } } cout << wynik << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...