# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
45664 | 2018-04-15T20:22:45 Z | reality | Art Exhibition (JOI18_art) | C++17 | 958 ms | 244224 KB |
#include "bits/stdc++.h" using namespace std; #define fi first #define se second #define ll long long #define dbg(v) cerr<<#v<<" = "<<v<<'\n' #define vi vector<int> #define vl vector <ll> #define pii pair<int,int> #define mp make_pair #define db long double #define pb push_back #define all(s) s.begin(),s.end() template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;} template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;} int main(void) { int n; scanf("%d",&n); map < ll , ll > M; for (int i = 0;i < n;++i) { ll u,v; scanf("%lld%lld",&u,&v); M[u] += v; } vector < pair < ll , ll > > s; for (auto it : M) s.pb(it); n = s.size(); vl ss; for (int i = 1;i < n;++i) s[i].se += s[i - 1].se; ll mn = -s[0].fi; ll ans = 0; for (int i = 1;i < n;++i) { if (i > 0) smin(mn,s[i - 1].se - s[i].fi); smax(ans,s[i].se - s[i].fi - mn); } cout << ans << '\n'; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 360 KB | Output is correct |
3 | Correct | 2 ms | 416 KB | Output is correct |
4 | Correct | 2 ms | 548 KB | Output is correct |
5 | Correct | 2 ms | 548 KB | Output is correct |
6 | Correct | 2 ms | 548 KB | Output is correct |
7 | Correct | 2 ms | 640 KB | Output is correct |
8 | Correct | 2 ms | 640 KB | Output is correct |
9 | Correct | 2 ms | 640 KB | Output is correct |
10 | Correct | 2 ms | 640 KB | Output is correct |
11 | Correct | 2 ms | 640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 360 KB | Output is correct |
3 | Correct | 2 ms | 416 KB | Output is correct |
4 | Correct | 2 ms | 548 KB | Output is correct |
5 | Correct | 2 ms | 548 KB | Output is correct |
6 | Correct | 2 ms | 548 KB | Output is correct |
7 | Correct | 2 ms | 640 KB | Output is correct |
8 | Correct | 2 ms | 640 KB | Output is correct |
9 | Correct | 2 ms | 640 KB | Output is correct |
10 | Correct | 2 ms | 640 KB | Output is correct |
11 | Correct | 2 ms | 640 KB | Output is correct |
12 | Correct | 2 ms | 640 KB | Output is correct |
13 | Correct | 2 ms | 640 KB | Output is correct |
14 | Correct | 2 ms | 640 KB | Output is correct |
15 | Correct | 2 ms | 640 KB | Output is correct |
16 | Correct | 2 ms | 640 KB | Output is correct |
17 | Correct | 2 ms | 640 KB | Output is correct |
18 | Correct | 2 ms | 640 KB | Output is correct |
19 | Correct | 2 ms | 640 KB | Output is correct |
20 | Correct | 2 ms | 640 KB | Output is correct |
21 | Correct | 2 ms | 640 KB | Output is correct |
22 | Correct | 2 ms | 640 KB | Output is correct |
23 | Correct | 2 ms | 640 KB | Output is correct |
24 | Correct | 2 ms | 640 KB | Output is correct |
25 | Correct | 2 ms | 640 KB | Output is correct |
26 | Correct | 2 ms | 640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 360 KB | Output is correct |
3 | Correct | 2 ms | 416 KB | Output is correct |
4 | Correct | 2 ms | 548 KB | Output is correct |
5 | Correct | 2 ms | 548 KB | Output is correct |
6 | Correct | 2 ms | 548 KB | Output is correct |
7 | Correct | 2 ms | 640 KB | Output is correct |
8 | Correct | 2 ms | 640 KB | Output is correct |
9 | Correct | 2 ms | 640 KB | Output is correct |
10 | Correct | 2 ms | 640 KB | Output is correct |
11 | Correct | 2 ms | 640 KB | Output is correct |
12 | Correct | 2 ms | 640 KB | Output is correct |
13 | Correct | 2 ms | 640 KB | Output is correct |
14 | Correct | 2 ms | 640 KB | Output is correct |
15 | Correct | 2 ms | 640 KB | Output is correct |
16 | Correct | 2 ms | 640 KB | Output is correct |
17 | Correct | 2 ms | 640 KB | Output is correct |
18 | Correct | 2 ms | 640 KB | Output is correct |
19 | Correct | 2 ms | 640 KB | Output is correct |
20 | Correct | 2 ms | 640 KB | Output is correct |
21 | Correct | 2 ms | 640 KB | Output is correct |
22 | Correct | 2 ms | 640 KB | Output is correct |
23 | Correct | 2 ms | 640 KB | Output is correct |
24 | Correct | 2 ms | 640 KB | Output is correct |
25 | Correct | 2 ms | 640 KB | Output is correct |
26 | Correct | 2 ms | 640 KB | Output is correct |
27 | Correct | 5 ms | 1124 KB | Output is correct |
28 | Correct | 6 ms | 1124 KB | Output is correct |
29 | Correct | 5 ms | 1124 KB | Output is correct |
30 | Correct | 7 ms | 1124 KB | Output is correct |
31 | Correct | 6 ms | 1124 KB | Output is correct |
32 | Correct | 6 ms | 1124 KB | Output is correct |
33 | Correct | 5 ms | 1124 KB | Output is correct |
34 | Correct | 6 ms | 1124 KB | Output is correct |
35 | Correct | 6 ms | 1188 KB | Output is correct |
36 | Correct | 6 ms | 1188 KB | Output is correct |
37 | Correct | 6 ms | 1188 KB | Output is correct |
38 | Correct | 6 ms | 1188 KB | Output is correct |
39 | Correct | 5 ms | 1260 KB | Output is correct |
40 | Correct | 6 ms | 1260 KB | Output is correct |
41 | Correct | 5 ms | 1260 KB | Output is correct |
42 | Correct | 6 ms | 1260 KB | Output is correct |
43 | Correct | 6 ms | 1260 KB | Output is correct |
44 | Correct | 8 ms | 1260 KB | Output is correct |
45 | Correct | 6 ms | 1260 KB | Output is correct |
46 | Correct | 5 ms | 1260 KB | Output is correct |
47 | Correct | 8 ms | 1260 KB | Output is correct |
48 | Correct | 5 ms | 1260 KB | Output is correct |
49 | Correct | 5 ms | 1260 KB | Output is correct |
50 | Correct | 5 ms | 1260 KB | Output is correct |
51 | Correct | 8 ms | 1268 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 360 KB | Output is correct |
3 | Correct | 2 ms | 416 KB | Output is correct |
4 | Correct | 2 ms | 548 KB | Output is correct |
5 | Correct | 2 ms | 548 KB | Output is correct |
6 | Correct | 2 ms | 548 KB | Output is correct |
7 | Correct | 2 ms | 640 KB | Output is correct |
8 | Correct | 2 ms | 640 KB | Output is correct |
9 | Correct | 2 ms | 640 KB | Output is correct |
10 | Correct | 2 ms | 640 KB | Output is correct |
11 | Correct | 2 ms | 640 KB | Output is correct |
12 | Correct | 2 ms | 640 KB | Output is correct |
13 | Correct | 2 ms | 640 KB | Output is correct |
14 | Correct | 2 ms | 640 KB | Output is correct |
15 | Correct | 2 ms | 640 KB | Output is correct |
16 | Correct | 2 ms | 640 KB | Output is correct |
17 | Correct | 2 ms | 640 KB | Output is correct |
18 | Correct | 2 ms | 640 KB | Output is correct |
19 | Correct | 2 ms | 640 KB | Output is correct |
20 | Correct | 2 ms | 640 KB | Output is correct |
21 | Correct | 2 ms | 640 KB | Output is correct |
22 | Correct | 2 ms | 640 KB | Output is correct |
23 | Correct | 2 ms | 640 KB | Output is correct |
24 | Correct | 2 ms | 640 KB | Output is correct |
25 | Correct | 2 ms | 640 KB | Output is correct |
26 | Correct | 2 ms | 640 KB | Output is correct |
27 | Correct | 5 ms | 1124 KB | Output is correct |
28 | Correct | 6 ms | 1124 KB | Output is correct |
29 | Correct | 5 ms | 1124 KB | Output is correct |
30 | Correct | 7 ms | 1124 KB | Output is correct |
31 | Correct | 6 ms | 1124 KB | Output is correct |
32 | Correct | 6 ms | 1124 KB | Output is correct |
33 | Correct | 5 ms | 1124 KB | Output is correct |
34 | Correct | 6 ms | 1124 KB | Output is correct |
35 | Correct | 6 ms | 1188 KB | Output is correct |
36 | Correct | 6 ms | 1188 KB | Output is correct |
37 | Correct | 6 ms | 1188 KB | Output is correct |
38 | Correct | 6 ms | 1188 KB | Output is correct |
39 | Correct | 5 ms | 1260 KB | Output is correct |
40 | Correct | 6 ms | 1260 KB | Output is correct |
41 | Correct | 5 ms | 1260 KB | Output is correct |
42 | Correct | 6 ms | 1260 KB | Output is correct |
43 | Correct | 6 ms | 1260 KB | Output is correct |
44 | Correct | 8 ms | 1260 KB | Output is correct |
45 | Correct | 6 ms | 1260 KB | Output is correct |
46 | Correct | 5 ms | 1260 KB | Output is correct |
47 | Correct | 8 ms | 1260 KB | Output is correct |
48 | Correct | 5 ms | 1260 KB | Output is correct |
49 | Correct | 5 ms | 1260 KB | Output is correct |
50 | Correct | 5 ms | 1260 KB | Output is correct |
51 | Correct | 8 ms | 1268 KB | Output is correct |
52 | Correct | 911 ms | 41436 KB | Output is correct |
53 | Correct | 937 ms | 54352 KB | Output is correct |
54 | Correct | 878 ms | 66852 KB | Output is correct |
55 | Correct | 899 ms | 79588 KB | Output is correct |
56 | Correct | 888 ms | 92436 KB | Output is correct |
57 | Correct | 852 ms | 105108 KB | Output is correct |
58 | Correct | 859 ms | 117736 KB | Output is correct |
59 | Correct | 841 ms | 130248 KB | Output is correct |
60 | Correct | 948 ms | 143132 KB | Output is correct |
61 | Correct | 937 ms | 155672 KB | Output is correct |
62 | Correct | 910 ms | 168204 KB | Output is correct |
63 | Correct | 958 ms | 180868 KB | Output is correct |
64 | Correct | 952 ms | 193548 KB | Output is correct |
65 | Correct | 954 ms | 206340 KB | Output is correct |
66 | Correct | 908 ms | 218920 KB | Output is correct |
67 | Correct | 822 ms | 231592 KB | Output is correct |
68 | Correct | 842 ms | 244224 KB | Output is correct |