Submission #1066964

#TimeUsernameProblemLanguageResultExecution timeMemory
1066964SzymonKrzywdaArt Exhibition (JOI18_art)C++17
0 / 100
0 ms344 KiB
#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; int pop = tab[0].first; int akt_wynik = 0; for (auto [i_1,i_2] : tab){ akt_wynik = max(akt_wynik-(i_1-pop)+i_2,i_2); pop = i_1; 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...