# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
200111 | 2020-02-05T11:34:56 Z | aloo123 | Art Exhibition (JOI18_art) | C++14 | 5 ms | 376 KB |
#include <bits/stdc++.h> #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #define ll long long #define ld long double #define f first #define s second #define mp make_pair #define pb push_back #define vll vector<ll> #define pll pair<ll,ll> using namespace std; const ll N = 5e5+100; const ll MOD = 1e9+7; ll pre[N]; ll maxx[N]; int main() { ll n; cin>>n; pll a[n+1]; for(int i =1;i<=n;i++)cin>>a[i].f >> a[i].s; sort(a+1,a+n+1); for(int i =1;i<=n;i++){ pre[i] = pre[i-1] + a[i].s; } for(int i =1;i<=n;i++){ maxx[i] = max(maxx[i-1],a[i].f-pre[i-1]); } ll ans = 0; for(int j =1;j<=n;j++){ ans = max(ans,(pre[j]-a[j].f) + (maxx[j-1])); } cout<<ans<<endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |