# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
875765 |
2023-11-20T12:50:12 Z |
Isam |
Art Exhibition (JOI18_art) |
C++17 |
|
1000 ms |
10028 KB |
#include<bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define int long long
#define a first
#define b second
#define pii pair<int, int>
using namespace std;
const int sz = 2e5 + 5;
const int inf = 1e15 + 7;
int n, ans;
pii c[sz];
int pref[sz];
int comp(int mna, int mxa, int s){
return s - (mxa - mna);
}
signed main(){
SPEED;
cin >> n;
for(register int i = 1; i <= n; ++i){
cin >> c[i].a >> c[i].b;
c[i].b *= (-1);
}
sort(c+1, c+n+1);
for(register int i = 1; i <= n; ++i) pref[i] = pref[i-1] - c[i].b;
for(register int i = 1; i < n; ++i){
for(register int j = i; j <= n; ++j){
int tmp = comp(c[i].a, c[j].a, pref[j] - pref[i-1]);
ans = max(ans, tmp);
}
}
cout << ans << '\n';
return 0;
}
Compilation message
art.cpp: In function 'int main()':
art.cpp:27:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
27 | for(register int i = 1; i <= n; ++i){
| ^
art.cpp:32:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
32 | for(register int i = 1; i <= n; ++i) pref[i] = pref[i-1] - c[i].b;
| ^
art.cpp:33:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
33 | for(register int i = 1; i < n; ++i){
| ^
art.cpp:34:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
34 | for(register int j = i; j <= n; ++j){
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
0 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2412 KB |
Output is correct |
9 |
Correct |
1 ms |
2392 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
0 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2412 KB |
Output is correct |
9 |
Correct |
1 ms |
2392 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1 ms |
2516 KB |
Output is correct |
15 |
Correct |
1 ms |
2396 KB |
Output is correct |
16 |
Correct |
1 ms |
2396 KB |
Output is correct |
17 |
Correct |
1 ms |
2396 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
19 |
Correct |
1 ms |
2396 KB |
Output is correct |
20 |
Correct |
1 ms |
2396 KB |
Output is correct |
21 |
Correct |
1 ms |
2396 KB |
Output is correct |
22 |
Correct |
1 ms |
2392 KB |
Output is correct |
23 |
Correct |
1 ms |
2396 KB |
Output is correct |
24 |
Correct |
1 ms |
2396 KB |
Output is correct |
25 |
Correct |
1 ms |
2392 KB |
Output is correct |
26 |
Correct |
1 ms |
2392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
0 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2412 KB |
Output is correct |
9 |
Correct |
1 ms |
2392 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1 ms |
2516 KB |
Output is correct |
15 |
Correct |
1 ms |
2396 KB |
Output is correct |
16 |
Correct |
1 ms |
2396 KB |
Output is correct |
17 |
Correct |
1 ms |
2396 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
19 |
Correct |
1 ms |
2396 KB |
Output is correct |
20 |
Correct |
1 ms |
2396 KB |
Output is correct |
21 |
Correct |
1 ms |
2396 KB |
Output is correct |
22 |
Correct |
1 ms |
2392 KB |
Output is correct |
23 |
Correct |
1 ms |
2396 KB |
Output is correct |
24 |
Correct |
1 ms |
2396 KB |
Output is correct |
25 |
Correct |
1 ms |
2392 KB |
Output is correct |
26 |
Correct |
1 ms |
2392 KB |
Output is correct |
27 |
Correct |
17 ms |
2652 KB |
Output is correct |
28 |
Correct |
13 ms |
2648 KB |
Output is correct |
29 |
Correct |
13 ms |
2652 KB |
Output is correct |
30 |
Correct |
15 ms |
2652 KB |
Output is correct |
31 |
Correct |
13 ms |
2648 KB |
Output is correct |
32 |
Correct |
13 ms |
2652 KB |
Output is correct |
33 |
Correct |
16 ms |
2652 KB |
Output is correct |
34 |
Correct |
14 ms |
2684 KB |
Output is correct |
35 |
Correct |
13 ms |
2684 KB |
Output is correct |
36 |
Correct |
15 ms |
2908 KB |
Output is correct |
37 |
Correct |
13 ms |
2680 KB |
Output is correct |
38 |
Correct |
13 ms |
2652 KB |
Output is correct |
39 |
Correct |
13 ms |
2652 KB |
Output is correct |
40 |
Correct |
16 ms |
2652 KB |
Output is correct |
41 |
Correct |
13 ms |
2652 KB |
Output is correct |
42 |
Correct |
14 ms |
2652 KB |
Output is correct |
43 |
Correct |
18 ms |
2652 KB |
Output is correct |
44 |
Correct |
13 ms |
2648 KB |
Output is correct |
45 |
Correct |
13 ms |
2652 KB |
Output is correct |
46 |
Correct |
13 ms |
2684 KB |
Output is correct |
47 |
Correct |
14 ms |
2680 KB |
Output is correct |
48 |
Correct |
13 ms |
2652 KB |
Output is correct |
49 |
Correct |
13 ms |
2684 KB |
Output is correct |
50 |
Correct |
13 ms |
2648 KB |
Output is correct |
51 |
Correct |
14 ms |
2652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
0 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2412 KB |
Output is correct |
9 |
Correct |
1 ms |
2392 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1 ms |
2516 KB |
Output is correct |
15 |
Correct |
1 ms |
2396 KB |
Output is correct |
16 |
Correct |
1 ms |
2396 KB |
Output is correct |
17 |
Correct |
1 ms |
2396 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
19 |
Correct |
1 ms |
2396 KB |
Output is correct |
20 |
Correct |
1 ms |
2396 KB |
Output is correct |
21 |
Correct |
1 ms |
2396 KB |
Output is correct |
22 |
Correct |
1 ms |
2392 KB |
Output is correct |
23 |
Correct |
1 ms |
2396 KB |
Output is correct |
24 |
Correct |
1 ms |
2396 KB |
Output is correct |
25 |
Correct |
1 ms |
2392 KB |
Output is correct |
26 |
Correct |
1 ms |
2392 KB |
Output is correct |
27 |
Correct |
17 ms |
2652 KB |
Output is correct |
28 |
Correct |
13 ms |
2648 KB |
Output is correct |
29 |
Correct |
13 ms |
2652 KB |
Output is correct |
30 |
Correct |
15 ms |
2652 KB |
Output is correct |
31 |
Correct |
13 ms |
2648 KB |
Output is correct |
32 |
Correct |
13 ms |
2652 KB |
Output is correct |
33 |
Correct |
16 ms |
2652 KB |
Output is correct |
34 |
Correct |
14 ms |
2684 KB |
Output is correct |
35 |
Correct |
13 ms |
2684 KB |
Output is correct |
36 |
Correct |
15 ms |
2908 KB |
Output is correct |
37 |
Correct |
13 ms |
2680 KB |
Output is correct |
38 |
Correct |
13 ms |
2652 KB |
Output is correct |
39 |
Correct |
13 ms |
2652 KB |
Output is correct |
40 |
Correct |
16 ms |
2652 KB |
Output is correct |
41 |
Correct |
13 ms |
2652 KB |
Output is correct |
42 |
Correct |
14 ms |
2652 KB |
Output is correct |
43 |
Correct |
18 ms |
2652 KB |
Output is correct |
44 |
Correct |
13 ms |
2648 KB |
Output is correct |
45 |
Correct |
13 ms |
2652 KB |
Output is correct |
46 |
Correct |
13 ms |
2684 KB |
Output is correct |
47 |
Correct |
14 ms |
2680 KB |
Output is correct |
48 |
Correct |
13 ms |
2652 KB |
Output is correct |
49 |
Correct |
13 ms |
2684 KB |
Output is correct |
50 |
Correct |
13 ms |
2648 KB |
Output is correct |
51 |
Correct |
14 ms |
2652 KB |
Output is correct |
52 |
Execution timed out |
1069 ms |
10028 KB |
Time limit exceeded |
53 |
Halted |
0 ms |
0 KB |
- |