# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1108382 | 2024-11-04T03:09:33 Z | vjudge1 | Art Exhibition (JOI18_art) | C++17 | 1 ms | 336 KB |
#include<bits/stdc++.h> using namespace std; #define ll long long #define FOR(i, a, b) for(int i=(a), _b=(b); i<=_b; i++) #define FORD(i, a, b) for(int i=(a), _b=(b); i>=_b; i--) #define BIT(i, j) ((i>>j)&1) #define pb push_back #define ii pair<ll, ll> #define pii pair<ll, ii> #define fi first #define se second #define task "task" const ll inf = 1e18; const ll mod = 1e9+7; const ll N = 500005; const ll M = 50005; ll n, s[N], ans, prefix[N], t; ii a[N]; void solve() { cin >> n; for(int i = 1; i <= n; i++) { cin >> a[i].fi >> a[i].se; } sort(a+1, a+n+1); for(int i = 1; i <= n; i++) { prefix[i] = max(prefix[i-1], a[i].fi - t); t += a[i].se; ans = max(ans, t + prefix[i-1] - a[i].fi); } cout << ans; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); if(fopen(task".INP", "r")) { freopen(task".INP", "r", stdin); freopen(task".OUT", "w", stdout); } solve(); return 0; }
Compilation message
# | 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 | - |