# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
553247 | 2022-04-25T08:28:21 Z | sandry24 | Art Exhibition (JOI18_art) | C++17 | 0 ms | 212 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; #define pb push_back #define mp make_pair #define f first #define s second bool cust_sort(ll a, ll b){ } void solve(){ int n; cin >> n; vector<pair<ll, ll>> a(n); for(int i = 0; i < n; i++) cin >> a[i].f >> a[i].s; sort(a.begin(), a.end()); vector<ll> prefix(n); prefix[0] = a[0].s; for(int i = 1; i < n; i++) prefix[i] = a[i].s + prefix[i-1]; ll ans = 0; for(int i = 0; i < n; i++){ for(int j = i+1; j < n; j++){ ll temp = 0; if(i == 0) temp += prefix[j]; else temp += prefix[j] - prefix[i]; temp -= a[j].f - a[i].f; ans = max(ans, temp); } } cout << ans << '\n'; } int main() { ios::sync_with_stdio(0); cin.tie(0); int t = 1; //cin >> t; while(t--){ solve(); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |