# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
60391 | 2018-07-24T05:06:23 Z | gusfring | Art Exhibition (JOI18_art) | C++14 | 39 ms | 4656 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e3 + 5; typedef long long ll; #define sz first #define val second pair<ll, ll> C[MAXN]; int N; int main(){ scanf("%d", &N); for(int i=1; i<=N; ++i) scanf("%lld %lld", &C[i].sz, &C[i].val); sort(C + 1, C + N + 1); ll res = 0; for(int i=1; i<=N; ++i){ ll sum = 0; for(int j=i; j<=N; ++j){ sum += C[j].val; res = max(res, sum - (C[j].sz - C[i].sz)); } } printf("%lld\n", res); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 4 ms | 360 KB | Output is correct |
3 | Correct | 4 ms | 528 KB | Output is correct |
4 | Correct | 3 ms | 528 KB | Output is correct |
5 | Correct | 3 ms | 712 KB | Output is correct |
6 | Correct | 3 ms | 712 KB | Output is correct |
7 | Correct | 3 ms | 712 KB | Output is correct |
8 | Correct | 3 ms | 712 KB | Output is correct |
9 | Correct | 3 ms | 712 KB | Output is correct |
10 | Correct | 3 ms | 712 KB | Output is correct |
11 | Correct | 3 ms | 712 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 4 ms | 360 KB | Output is correct |
3 | Correct | 4 ms | 528 KB | Output is correct |
4 | Correct | 3 ms | 528 KB | Output is correct |
5 | Correct | 3 ms | 712 KB | Output is correct |
6 | Correct | 3 ms | 712 KB | Output is correct |
7 | Correct | 3 ms | 712 KB | Output is correct |
8 | Correct | 3 ms | 712 KB | Output is correct |
9 | Correct | 3 ms | 712 KB | Output is correct |
10 | Correct | 3 ms | 712 KB | Output is correct |
11 | Correct | 3 ms | 712 KB | Output is correct |
12 | Correct | 5 ms | 760 KB | Output is correct |
13 | Correct | 2 ms | 776 KB | Output is correct |
14 | Correct | 4 ms | 792 KB | Output is correct |
15 | Correct | 4 ms | 816 KB | Output is correct |
16 | Correct | 5 ms | 840 KB | Output is correct |
17 | Correct | 3 ms | 848 KB | Output is correct |
18 | Correct | 2 ms | 856 KB | Output is correct |
19 | Correct | 4 ms | 864 KB | Output is correct |
20 | Correct | 3 ms | 864 KB | Output is correct |
21 | Correct | 3 ms | 880 KB | Output is correct |
22 | Correct | 3 ms | 888 KB | Output is correct |
23 | Correct | 4 ms | 896 KB | Output is correct |
24 | Correct | 0 ms | 908 KB | Output is correct |
25 | Correct | 3 ms | 908 KB | Output is correct |
26 | Correct | 4 ms | 920 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 4 ms | 360 KB | Output is correct |
3 | Correct | 4 ms | 528 KB | Output is correct |
4 | Correct | 3 ms | 528 KB | Output is correct |
5 | Correct | 3 ms | 712 KB | Output is correct |
6 | Correct | 3 ms | 712 KB | Output is correct |
7 | Correct | 3 ms | 712 KB | Output is correct |
8 | Correct | 3 ms | 712 KB | Output is correct |
9 | Correct | 3 ms | 712 KB | Output is correct |
10 | Correct | 3 ms | 712 KB | Output is correct |
11 | Correct | 3 ms | 712 KB | Output is correct |
12 | Correct | 5 ms | 760 KB | Output is correct |
13 | Correct | 2 ms | 776 KB | Output is correct |
14 | Correct | 4 ms | 792 KB | Output is correct |
15 | Correct | 4 ms | 816 KB | Output is correct |
16 | Correct | 5 ms | 840 KB | Output is correct |
17 | Correct | 3 ms | 848 KB | Output is correct |
18 | Correct | 2 ms | 856 KB | Output is correct |
19 | Correct | 4 ms | 864 KB | Output is correct |
20 | Correct | 3 ms | 864 KB | Output is correct |
21 | Correct | 3 ms | 880 KB | Output is correct |
22 | Correct | 3 ms | 888 KB | Output is correct |
23 | Correct | 4 ms | 896 KB | Output is correct |
24 | Correct | 0 ms | 908 KB | Output is correct |
25 | Correct | 3 ms | 908 KB | Output is correct |
26 | Correct | 4 ms | 920 KB | Output is correct |
27 | Correct | 27 ms | 1056 KB | Output is correct |
28 | Correct | 28 ms | 1164 KB | Output is correct |
29 | Correct | 39 ms | 1312 KB | Output is correct |
30 | Correct | 31 ms | 1440 KB | Output is correct |
31 | Correct | 27 ms | 1584 KB | Output is correct |
32 | Correct | 35 ms | 1712 KB | Output is correct |
33 | Correct | 32 ms | 1968 KB | Output is correct |
34 | Correct | 38 ms | 2088 KB | Output is correct |
35 | Correct | 28 ms | 2096 KB | Output is correct |
36 | Correct | 26 ms | 2224 KB | Output is correct |
37 | Correct | 31 ms | 2352 KB | Output is correct |
38 | Correct | 25 ms | 2480 KB | Output is correct |
39 | Correct | 20 ms | 2608 KB | Output is correct |
40 | Correct | 38 ms | 2796 KB | Output is correct |
41 | Correct | 29 ms | 2992 KB | Output is correct |
42 | Correct | 27 ms | 2992 KB | Output is correct |
43 | Correct | 31 ms | 3180 KB | Output is correct |
44 | Correct | 31 ms | 3244 KB | Output is correct |
45 | Correct | 28 ms | 3372 KB | Output is correct |
46 | Correct | 29 ms | 3500 KB | Output is correct |
47 | Correct | 28 ms | 3628 KB | Output is correct |
48 | Correct | 28 ms | 3756 KB | Output is correct |
49 | Correct | 30 ms | 3892 KB | Output is correct |
50 | Correct | 30 ms | 4016 KB | Output is correct |
51 | Correct | 30 ms | 4144 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 4 ms | 360 KB | Output is correct |
3 | Correct | 4 ms | 528 KB | Output is correct |
4 | Correct | 3 ms | 528 KB | Output is correct |
5 | Correct | 3 ms | 712 KB | Output is correct |
6 | Correct | 3 ms | 712 KB | Output is correct |
7 | Correct | 3 ms | 712 KB | Output is correct |
8 | Correct | 3 ms | 712 KB | Output is correct |
9 | Correct | 3 ms | 712 KB | Output is correct |
10 | Correct | 3 ms | 712 KB | Output is correct |
11 | Correct | 3 ms | 712 KB | Output is correct |
12 | Correct | 5 ms | 760 KB | Output is correct |
13 | Correct | 2 ms | 776 KB | Output is correct |
14 | Correct | 4 ms | 792 KB | Output is correct |
15 | Correct | 4 ms | 816 KB | Output is correct |
16 | Correct | 5 ms | 840 KB | Output is correct |
17 | Correct | 3 ms | 848 KB | Output is correct |
18 | Correct | 2 ms | 856 KB | Output is correct |
19 | Correct | 4 ms | 864 KB | Output is correct |
20 | Correct | 3 ms | 864 KB | Output is correct |
21 | Correct | 3 ms | 880 KB | Output is correct |
22 | Correct | 3 ms | 888 KB | Output is correct |
23 | Correct | 4 ms | 896 KB | Output is correct |
24 | Correct | 0 ms | 908 KB | Output is correct |
25 | Correct | 3 ms | 908 KB | Output is correct |
26 | Correct | 4 ms | 920 KB | Output is correct |
27 | Correct | 27 ms | 1056 KB | Output is correct |
28 | Correct | 28 ms | 1164 KB | Output is correct |
29 | Correct | 39 ms | 1312 KB | Output is correct |
30 | Correct | 31 ms | 1440 KB | Output is correct |
31 | Correct | 27 ms | 1584 KB | Output is correct |
32 | Correct | 35 ms | 1712 KB | Output is correct |
33 | Correct | 32 ms | 1968 KB | Output is correct |
34 | Correct | 38 ms | 2088 KB | Output is correct |
35 | Correct | 28 ms | 2096 KB | Output is correct |
36 | Correct | 26 ms | 2224 KB | Output is correct |
37 | Correct | 31 ms | 2352 KB | Output is correct |
38 | Correct | 25 ms | 2480 KB | Output is correct |
39 | Correct | 20 ms | 2608 KB | Output is correct |
40 | Correct | 38 ms | 2796 KB | Output is correct |
41 | Correct | 29 ms | 2992 KB | Output is correct |
42 | Correct | 27 ms | 2992 KB | Output is correct |
43 | Correct | 31 ms | 3180 KB | Output is correct |
44 | Correct | 31 ms | 3244 KB | Output is correct |
45 | Correct | 28 ms | 3372 KB | Output is correct |
46 | Correct | 29 ms | 3500 KB | Output is correct |
47 | Correct | 28 ms | 3628 KB | Output is correct |
48 | Correct | 28 ms | 3756 KB | Output is correct |
49 | Correct | 30 ms | 3892 KB | Output is correct |
50 | Correct | 30 ms | 4016 KB | Output is correct |
51 | Correct | 30 ms | 4144 KB | Output is correct |
52 | Execution timed out | 8 ms | 4656 KB | Time limit exceeded (wall clock) |
53 | Halted | 0 ms | 0 KB | - |