제출 #699273

#제출 시각아이디문제언어결과실행 시간메모리
699273Mohamed_Kachef06Art Exhibition (JOI18_art)C++17
50 / 100
1100 ms8704 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define A first #define B second signed main(){ int n; cin >> n; pair<int , int> p[n+1]; for (int i = 1 ; i<=n ; i++){ int a , b; cin >> a >> b; p[i] = {a , b}; } sort(p , p+n+1); for (int i = 1 ; i<=n ; i++){ p[i].B += p[i-1].B; } int max = 0; for (int l = 1 ; l<=n ; l++){ for (int r = l ; r<=n ; r++){ int x = (p[r].B-p[l-1].B) - (p[r].A-p[l].A); if ( x > max) max = x; } } cout << max << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...