Submission #1109182

# Submission time Handle Problem Language Result Execution time Memory
1109182 2024-11-06T07:27:11 Z vjudge1 Art Exhibition (JOI18_art) C++14
0 / 100
1 ms 336 KB
#include <bits/stdc++.h>
using namespace std;

#define NAME "name"

#define ll long long
#define pb push_back
#define pii pair<ll, ll>
#define fi first
#define se second
#define endl "\n"

#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

const int LIM = 1e6 + 3;
const int INF = 1e9 + 9;
const int mod = 1e9 + 7;

int n;
pii a[LIM];

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    if (ifstream(NAME ".inp"))
    {
        freopen(NAME ".inp", "r", stdin);
        freopen(NAME ".out", "w", stdout);
    }

    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i].fi >> a[i].se;
    sort(a + 1, a + n + 1);
    ll mines = a[1].fi, ans = 0;
    for (int i = 1; i <= n; i++)
    {
        a[i].se += a[i - 1].se;
        ans = max(ans, a[i].se - a[i].fi - mines);
        mines = min(mines, a[i - 1].se - a[i].fi);
    }
    cout << ans;

    return 0;
}

Compilation message

art.cpp: In function 'int main()':
art.cpp:32:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         freopen(NAME ".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
art.cpp:33:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         freopen(NAME ".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -