Submission #1108466

# Submission time Handle Problem Language Result Execution time Memory
1108466 2024-11-04T07:58:21 Z vjudge1 Art Exhibition (JOI18_art) C++17
0 / 100
1 ms 2384 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 5e5 + 1;
int pre[N],n;
pair<int,int> a[N];
signed main()
{
    cin >> n;
    for(int i = 1; i <= n; i ++)
    {
        cin >> a[i].first >> a[i].second;
     }
     sort(a+1,a+n+1);
     for(int i = 1; i <= n; i ++)
     {
         pre[i] = pre[i-1] + a[i].second;
     }
     int minn = - a[1].first,ans = -1e18;
     for(int i = 2; i <= n; i++)
     {
        ans = max(ans,pre[i] - a[i].first - minn);
        minn = min(pre[i-1]-a[i].first,minn);
     }
     cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -