# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
211967 | 2020-03-21T20:54:53 Z | Harry464 | Art Exhibition (JOI18_art) | C++14 | 5 ms | 256 KB |
#include <iostream> #include <vector> #include <utility> #include <algorithm> using namespace std; #define ll long long int main() { ll n; cin >> n; vector <pair <ll,ll> > a(n); for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second; sort(a.begin(),a.end()); ll md = 0, ms = 0; vector <ll> kum(n+1,0); for (int i = 1; i <= n; i++) kum[i] = kum[i-1] + a[i-1].second; for (int i = 1; i <= n; i++){ ll tren = kum[i] - a[i-1].first; ll md = min(md,kum[i-1] - a[i-1].first); tren -= md; ms = max(ms,tren); } cout << ms; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Incorrect | 4 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Incorrect | 4 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Incorrect | 4 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Incorrect | 4 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |