# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
70170 |
2018-08-22T12:45:02 Z |
3zp |
Art Exhibition (JOI18_art) |
C++14 |
|
66 ms |
7108 KB |
#include<bits/stdc++.h>
#define maxn 50009
using namespace std;
pair<long long,long long> a[maxn];
long long A[maxn], s[maxn], B[maxn];
main(){
long long n;
cin >> n;
for(long long i= 1; i <= n; i++)
cin >> a[i].first >> a[i].second;
sort(a + 1, a + n + 1);
for(long long i = 1; i <= n; i++){
s[i] = s[i - 1] + a[i] . second;
}
for(long long i = 1 ; i <= n; i++){
A[i] = s[i] - a[i] . first;
B[i] = -a[i] .first + s[i - 1];
}
long long MI = 1e18, ans = -1e18;
for(long long i = 1; i <= n; i++){
MI = min(MI, B[i]);
ans = max(ans, A[i] - MI);
}
cout<< ans << endl;
}
Compilation message
art.cpp:6:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main(){
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
496 KB |
Output is correct |
3 |
Correct |
2 ms |
496 KB |
Output is correct |
4 |
Correct |
4 ms |
528 KB |
Output is correct |
5 |
Correct |
3 ms |
544 KB |
Output is correct |
6 |
Correct |
2 ms |
544 KB |
Output is correct |
7 |
Correct |
2 ms |
552 KB |
Output is correct |
8 |
Correct |
3 ms |
556 KB |
Output is correct |
9 |
Correct |
3 ms |
632 KB |
Output is correct |
10 |
Correct |
3 ms |
644 KB |
Output is correct |
11 |
Correct |
2 ms |
648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
496 KB |
Output is correct |
3 |
Correct |
2 ms |
496 KB |
Output is correct |
4 |
Correct |
4 ms |
528 KB |
Output is correct |
5 |
Correct |
3 ms |
544 KB |
Output is correct |
6 |
Correct |
2 ms |
544 KB |
Output is correct |
7 |
Correct |
2 ms |
552 KB |
Output is correct |
8 |
Correct |
3 ms |
556 KB |
Output is correct |
9 |
Correct |
3 ms |
632 KB |
Output is correct |
10 |
Correct |
3 ms |
644 KB |
Output is correct |
11 |
Correct |
2 ms |
648 KB |
Output is correct |
12 |
Correct |
3 ms |
700 KB |
Output is correct |
13 |
Correct |
4 ms |
708 KB |
Output is correct |
14 |
Correct |
4 ms |
732 KB |
Output is correct |
15 |
Correct |
4 ms |
828 KB |
Output is correct |
16 |
Correct |
3 ms |
840 KB |
Output is correct |
17 |
Correct |
3 ms |
864 KB |
Output is correct |
18 |
Correct |
3 ms |
888 KB |
Output is correct |
19 |
Correct |
3 ms |
988 KB |
Output is correct |
20 |
Correct |
3 ms |
988 KB |
Output is correct |
21 |
Correct |
4 ms |
988 KB |
Output is correct |
22 |
Correct |
4 ms |
988 KB |
Output is correct |
23 |
Correct |
3 ms |
988 KB |
Output is correct |
24 |
Correct |
4 ms |
1064 KB |
Output is correct |
25 |
Correct |
5 ms |
1064 KB |
Output is correct |
26 |
Correct |
3 ms |
1064 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
496 KB |
Output is correct |
3 |
Correct |
2 ms |
496 KB |
Output is correct |
4 |
Correct |
4 ms |
528 KB |
Output is correct |
5 |
Correct |
3 ms |
544 KB |
Output is correct |
6 |
Correct |
2 ms |
544 KB |
Output is correct |
7 |
Correct |
2 ms |
552 KB |
Output is correct |
8 |
Correct |
3 ms |
556 KB |
Output is correct |
9 |
Correct |
3 ms |
632 KB |
Output is correct |
10 |
Correct |
3 ms |
644 KB |
Output is correct |
11 |
Correct |
2 ms |
648 KB |
Output is correct |
12 |
Correct |
3 ms |
700 KB |
Output is correct |
13 |
Correct |
4 ms |
708 KB |
Output is correct |
14 |
Correct |
4 ms |
732 KB |
Output is correct |
15 |
Correct |
4 ms |
828 KB |
Output is correct |
16 |
Correct |
3 ms |
840 KB |
Output is correct |
17 |
Correct |
3 ms |
864 KB |
Output is correct |
18 |
Correct |
3 ms |
888 KB |
Output is correct |
19 |
Correct |
3 ms |
988 KB |
Output is correct |
20 |
Correct |
3 ms |
988 KB |
Output is correct |
21 |
Correct |
4 ms |
988 KB |
Output is correct |
22 |
Correct |
4 ms |
988 KB |
Output is correct |
23 |
Correct |
3 ms |
988 KB |
Output is correct |
24 |
Correct |
4 ms |
1064 KB |
Output is correct |
25 |
Correct |
5 ms |
1064 KB |
Output is correct |
26 |
Correct |
3 ms |
1064 KB |
Output is correct |
27 |
Correct |
10 ms |
1216 KB |
Output is correct |
28 |
Correct |
9 ms |
1476 KB |
Output is correct |
29 |
Correct |
13 ms |
1476 KB |
Output is correct |
30 |
Correct |
10 ms |
1612 KB |
Output is correct |
31 |
Correct |
13 ms |
1732 KB |
Output is correct |
32 |
Correct |
10 ms |
1860 KB |
Output is correct |
33 |
Correct |
14 ms |
1988 KB |
Output is correct |
34 |
Correct |
11 ms |
2172 KB |
Output is correct |
35 |
Correct |
12 ms |
2228 KB |
Output is correct |
36 |
Correct |
16 ms |
2372 KB |
Output is correct |
37 |
Correct |
10 ms |
2552 KB |
Output is correct |
38 |
Correct |
17 ms |
2628 KB |
Output is correct |
39 |
Correct |
10 ms |
2808 KB |
Output is correct |
40 |
Correct |
10 ms |
2884 KB |
Output is correct |
41 |
Correct |
13 ms |
3012 KB |
Output is correct |
42 |
Correct |
14 ms |
3264 KB |
Output is correct |
43 |
Correct |
11 ms |
3264 KB |
Output is correct |
44 |
Correct |
15 ms |
3392 KB |
Output is correct |
45 |
Correct |
11 ms |
3508 KB |
Output is correct |
46 |
Correct |
11 ms |
3648 KB |
Output is correct |
47 |
Correct |
10 ms |
3776 KB |
Output is correct |
48 |
Correct |
14 ms |
3956 KB |
Output is correct |
49 |
Correct |
9 ms |
4032 KB |
Output is correct |
50 |
Correct |
12 ms |
4160 KB |
Output is correct |
51 |
Correct |
12 ms |
4344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
496 KB |
Output is correct |
3 |
Correct |
2 ms |
496 KB |
Output is correct |
4 |
Correct |
4 ms |
528 KB |
Output is correct |
5 |
Correct |
3 ms |
544 KB |
Output is correct |
6 |
Correct |
2 ms |
544 KB |
Output is correct |
7 |
Correct |
2 ms |
552 KB |
Output is correct |
8 |
Correct |
3 ms |
556 KB |
Output is correct |
9 |
Correct |
3 ms |
632 KB |
Output is correct |
10 |
Correct |
3 ms |
644 KB |
Output is correct |
11 |
Correct |
2 ms |
648 KB |
Output is correct |
12 |
Correct |
3 ms |
700 KB |
Output is correct |
13 |
Correct |
4 ms |
708 KB |
Output is correct |
14 |
Correct |
4 ms |
732 KB |
Output is correct |
15 |
Correct |
4 ms |
828 KB |
Output is correct |
16 |
Correct |
3 ms |
840 KB |
Output is correct |
17 |
Correct |
3 ms |
864 KB |
Output is correct |
18 |
Correct |
3 ms |
888 KB |
Output is correct |
19 |
Correct |
3 ms |
988 KB |
Output is correct |
20 |
Correct |
3 ms |
988 KB |
Output is correct |
21 |
Correct |
4 ms |
988 KB |
Output is correct |
22 |
Correct |
4 ms |
988 KB |
Output is correct |
23 |
Correct |
3 ms |
988 KB |
Output is correct |
24 |
Correct |
4 ms |
1064 KB |
Output is correct |
25 |
Correct |
5 ms |
1064 KB |
Output is correct |
26 |
Correct |
3 ms |
1064 KB |
Output is correct |
27 |
Correct |
10 ms |
1216 KB |
Output is correct |
28 |
Correct |
9 ms |
1476 KB |
Output is correct |
29 |
Correct |
13 ms |
1476 KB |
Output is correct |
30 |
Correct |
10 ms |
1612 KB |
Output is correct |
31 |
Correct |
13 ms |
1732 KB |
Output is correct |
32 |
Correct |
10 ms |
1860 KB |
Output is correct |
33 |
Correct |
14 ms |
1988 KB |
Output is correct |
34 |
Correct |
11 ms |
2172 KB |
Output is correct |
35 |
Correct |
12 ms |
2228 KB |
Output is correct |
36 |
Correct |
16 ms |
2372 KB |
Output is correct |
37 |
Correct |
10 ms |
2552 KB |
Output is correct |
38 |
Correct |
17 ms |
2628 KB |
Output is correct |
39 |
Correct |
10 ms |
2808 KB |
Output is correct |
40 |
Correct |
10 ms |
2884 KB |
Output is correct |
41 |
Correct |
13 ms |
3012 KB |
Output is correct |
42 |
Correct |
14 ms |
3264 KB |
Output is correct |
43 |
Correct |
11 ms |
3264 KB |
Output is correct |
44 |
Correct |
15 ms |
3392 KB |
Output is correct |
45 |
Correct |
11 ms |
3508 KB |
Output is correct |
46 |
Correct |
11 ms |
3648 KB |
Output is correct |
47 |
Correct |
10 ms |
3776 KB |
Output is correct |
48 |
Correct |
14 ms |
3956 KB |
Output is correct |
49 |
Correct |
9 ms |
4032 KB |
Output is correct |
50 |
Correct |
12 ms |
4160 KB |
Output is correct |
51 |
Correct |
12 ms |
4344 KB |
Output is correct |
52 |
Runtime error |
66 ms |
7108 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
53 |
Halted |
0 ms |
0 KB |
- |