제출 #1289250

#제출 시각아이디문제언어결과실행 시간메모리
1289250Ekber_EkberArt Exhibition (JOI18_art)C++20
0 / 100
0 ms332 KiB
#include <bits/stdc++.h> #define GOOD_LUCK ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define int long long #define endl "\n" #define ff first #define ss second #define pb push_back #define all(v) v.begin(), v.end() using namespace std; constexpr int MAX = 2e+5 + 1, INF = 2e+16, MOD = 1e+9 + 7, K = 31; void _() { int n; cin >> n; vector <pair<int, int>> v(n); for (auto &i : v) cin >> i.ff >> i.ss; sort(all(v)); int sum=0, res=0; for (int i = 0; i < n; i++) { sum += v[i].ss; res = max(res, sum - v[i].ff + v[0].ff); } cout << res; } signed main() { GOOD_LUCK int tests=1; // cin >> tests; for (int i=1; i <= tests; i++) { _(); cout << 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...