제출 #757668

#제출 시각아이디문제언어결과실행 시간메모리
7576681binArt Exhibition (JOI18_art)C++14
100 / 100
230 ms9052 KiB
#include <bits/stdc++.h>

using namespace std;

#define all(v) v.begin(), v.end()
typedef long long ll;
ll n, a, b, mn, ans, sum;
vector<pair<ll, ll>> v;

int main(void){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a >> b;
        v.emplace_back(a, b);
    }
    sort(all(v));
    mn = 1e18;
    for(int i = 0; i < n; i++){
        auto&[a, b] = v[i];
        mn = min(mn, sum - a);
        sum += b;
        ans = max(ans, sum - a - mn);
    }
    cout << ans;
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

art.cpp: In function 'int main()':
art.cpp:21:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   21 |         auto&[a, b] = v[i];
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...