Submission #1109185

# Submission time Handle Problem Language Result Execution time Memory
1109185 2024-11-06T07:31:05 Z giaminh2211 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);
 
 
    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;
}
# 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 -