Submission #63335

# Submission time Handle Problem Language Result Execution time Memory
63335 2018-08-01T13:10:18 Z leejseo Art Exhibition (JOI18_art) C++14
50 / 100
1000 ms 28584 KB
#include<iostream>
#include<memory.h>
#include<utility>
#include<algorithm>
#include<vector>
 
using namespace std;
 
typedef long long lld;
 
lld n, s[500001] = {0LL, }, a, b, tmp;
vector<pair<lld, lld>> art;
 
int main() {
    ios::sync_with_stdio(0); 
    cin.tie(0);
    cin >> n;
    art.push_back(pair<lld, lld>(0, 0));
    for(int i = 0; i < n; i++) {
        cin >> a >> b;
        art.push_back(pair<lld, lld>(a, b));
    }
    sort(art.begin(), art.end());
    for(int i = 1; i <= n; i++) {
        s[i] = s[i-1] + art[i].second;
    }
    lld tmp = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = i; j <= n; j++) {
            tmp = max(tmp, s[j] - s[i-1] - (art[j].first - art[i].first));
        }
    }
    cout << tmp << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 492 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 3 ms 576 KB Output is correct
6 Correct 2 ms 584 KB Output is correct
7 Correct 3 ms 584 KB Output is correct
8 Correct 3 ms 632 KB Output is correct
9 Correct 2 ms 744 KB Output is correct
10 Correct 3 ms 744 KB Output is correct
11 Correct 3 ms 744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 492 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 3 ms 576 KB Output is correct
6 Correct 2 ms 584 KB Output is correct
7 Correct 3 ms 584 KB Output is correct
8 Correct 3 ms 632 KB Output is correct
9 Correct 2 ms 744 KB Output is correct
10 Correct 3 ms 744 KB Output is correct
11 Correct 3 ms 744 KB Output is correct
12 Correct 2 ms 756 KB Output is correct
13 Correct 4 ms 764 KB Output is correct
14 Correct 4 ms 788 KB Output is correct
15 Correct 3 ms 816 KB Output is correct
16 Correct 12 ms 836 KB Output is correct
17 Correct 3 ms 860 KB Output is correct
18 Correct 3 ms 860 KB Output is correct
19 Correct 3 ms 860 KB Output is correct
20 Correct 3 ms 860 KB Output is correct
21 Correct 3 ms 912 KB Output is correct
22 Correct 3 ms 1000 KB Output is correct
23 Correct 3 ms 1024 KB Output is correct
24 Correct 3 ms 1032 KB Output is correct
25 Correct 3 ms 1040 KB Output is correct
26 Correct 3 ms 1040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 492 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 3 ms 576 KB Output is correct
6 Correct 2 ms 584 KB Output is correct
7 Correct 3 ms 584 KB Output is correct
8 Correct 3 ms 632 KB Output is correct
9 Correct 2 ms 744 KB Output is correct
10 Correct 3 ms 744 KB Output is correct
11 Correct 3 ms 744 KB Output is correct
12 Correct 2 ms 756 KB Output is correct
13 Correct 4 ms 764 KB Output is correct
14 Correct 4 ms 788 KB Output is correct
15 Correct 3 ms 816 KB Output is correct
16 Correct 12 ms 836 KB Output is correct
17 Correct 3 ms 860 KB Output is correct
18 Correct 3 ms 860 KB Output is correct
19 Correct 3 ms 860 KB Output is correct
20 Correct 3 ms 860 KB Output is correct
21 Correct 3 ms 912 KB Output is correct
22 Correct 3 ms 1000 KB Output is correct
23 Correct 3 ms 1024 KB Output is correct
24 Correct 3 ms 1032 KB Output is correct
25 Correct 3 ms 1040 KB Output is correct
26 Correct 3 ms 1040 KB Output is correct
27 Correct 24 ms 1452 KB Output is correct
28 Correct 23 ms 1452 KB Output is correct
29 Correct 27 ms 1580 KB Output is correct
30 Correct 24 ms 1708 KB Output is correct
31 Correct 25 ms 1836 KB Output is correct
32 Correct 32 ms 2008 KB Output is correct
33 Correct 25 ms 2092 KB Output is correct
34 Correct 31 ms 2220 KB Output is correct
35 Correct 23 ms 2348 KB Output is correct
36 Correct 24 ms 2476 KB Output is correct
37 Correct 22 ms 2604 KB Output is correct
38 Correct 25 ms 2848 KB Output is correct
39 Correct 24 ms 2860 KB Output is correct
40 Correct 30 ms 2988 KB Output is correct
41 Correct 23 ms 3032 KB Output is correct
42 Correct 26 ms 3244 KB Output is correct
43 Correct 22 ms 3368 KB Output is correct
44 Correct 27 ms 3496 KB Output is correct
45 Correct 24 ms 3624 KB Output is correct
46 Correct 25 ms 3752 KB Output is correct
47 Correct 21 ms 3880 KB Output is correct
48 Correct 22 ms 4008 KB Output is correct
49 Correct 21 ms 4136 KB Output is correct
50 Correct 21 ms 4164 KB Output is correct
51 Correct 20 ms 4392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 492 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 3 ms 576 KB Output is correct
6 Correct 2 ms 584 KB Output is correct
7 Correct 3 ms 584 KB Output is correct
8 Correct 3 ms 632 KB Output is correct
9 Correct 2 ms 744 KB Output is correct
10 Correct 3 ms 744 KB Output is correct
11 Correct 3 ms 744 KB Output is correct
12 Correct 2 ms 756 KB Output is correct
13 Correct 4 ms 764 KB Output is correct
14 Correct 4 ms 788 KB Output is correct
15 Correct 3 ms 816 KB Output is correct
16 Correct 12 ms 836 KB Output is correct
17 Correct 3 ms 860 KB Output is correct
18 Correct 3 ms 860 KB Output is correct
19 Correct 3 ms 860 KB Output is correct
20 Correct 3 ms 860 KB Output is correct
21 Correct 3 ms 912 KB Output is correct
22 Correct 3 ms 1000 KB Output is correct
23 Correct 3 ms 1024 KB Output is correct
24 Correct 3 ms 1032 KB Output is correct
25 Correct 3 ms 1040 KB Output is correct
26 Correct 3 ms 1040 KB Output is correct
27 Correct 24 ms 1452 KB Output is correct
28 Correct 23 ms 1452 KB Output is correct
29 Correct 27 ms 1580 KB Output is correct
30 Correct 24 ms 1708 KB Output is correct
31 Correct 25 ms 1836 KB Output is correct
32 Correct 32 ms 2008 KB Output is correct
33 Correct 25 ms 2092 KB Output is correct
34 Correct 31 ms 2220 KB Output is correct
35 Correct 23 ms 2348 KB Output is correct
36 Correct 24 ms 2476 KB Output is correct
37 Correct 22 ms 2604 KB Output is correct
38 Correct 25 ms 2848 KB Output is correct
39 Correct 24 ms 2860 KB Output is correct
40 Correct 30 ms 2988 KB Output is correct
41 Correct 23 ms 3032 KB Output is correct
42 Correct 26 ms 3244 KB Output is correct
43 Correct 22 ms 3368 KB Output is correct
44 Correct 27 ms 3496 KB Output is correct
45 Correct 24 ms 3624 KB Output is correct
46 Correct 25 ms 3752 KB Output is correct
47 Correct 21 ms 3880 KB Output is correct
48 Correct 22 ms 4008 KB Output is correct
49 Correct 21 ms 4136 KB Output is correct
50 Correct 21 ms 4164 KB Output is correct
51 Correct 20 ms 4392 KB Output is correct
52 Execution timed out 1066 ms 28584 KB Time limit exceeded
53 Halted 0 ms 0 KB -