Submission #516301

# Submission time Handle Problem Language Result Execution time Memory
516301 2022-01-21T04:29:31 Z Jomnoi Art Exhibition (JOI18_art) C++17
0 / 100
1 ms 204 KB
#include <bits/stdc++.h>
#define DEBUG 0
using namespace std;

int main() {
    int n;
    cin >> n;

    vector <pair <long long, int>> vec;
    for(int i = 1; i <= n; i++) {
        long long a;
        int b;
        scanf(" %lld %d", &a, &b);
        vec.emplace_back(a, b);
    }
    sort(vec.begin(), vec.end());

    long long ans = vec[0].second - vec[0].first, sum = vec[0].second;
    for(int i = 1; i < n; i++) {
        sum += vec[i].second;
        ans = max(ans, sum - vec[i].first + vec[0].first);
    }
    cout << ans;
    return 0;
}

Compilation message

art.cpp: In function 'int main()':
art.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf(" %lld %d", &a, &b);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -