# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1108393 | 2024-11-04T03:57:48 Z | vjudge1 | Art Exhibition (JOI18_art) | C++17 | 1 ms | 2384 KB |
#include<bits/stdc++.h> using namespace std; #define ll long long #define FOR(i, a, b) for(int i = (a); i <= (b); i++) #define FORD(i, b, a) for(int i = (b); i >= (a); i--) #define pa pair<ll, ll> #define fi first #define se second #define bit(mask, j) (mask & (1<<j)) const ll mod = 1e9 + 7; const ll INF = 1e17; const ll N = 5e5 + 10; pa a[N]; ll s[N], ans = 0; int main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); #define NAME "hbmt" if(fopen(NAME".inp", "r")) { freopen(NAME".inp", "r", stdin); freopen(NAME".out", "w", stdout); } ll n; cin >> n; FOR(i, 1, n) { cin >> a[i].fi >> a[i].se; } sort(a + 1, a + n + 1); FOR(i, 1, n) { s[i] = s[i - 1] + a[i].se; } FOR(i, 1, n) { ll res = s[i] - a[i].fi + a[1].fi; ll res2 = s[n] - s[i - 1] - a[n].fi + a[i].fi; ans = max({ans, res, res2}); } cout << ans; return 0; }
Compilation message
# | 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 | - |