답안 #548841

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
548841 2022-04-14T13:29:40 Z Specialistas13 Art Exhibition (JOI18_art) C++17
50 / 100
1000 ms 8080 KB
#include <bits/stdc++.h>

using namespace std;

int N;
pair<long long, long long> v[600000];
long long maxi=0, minid=0, maxid=0, S=0;
int main()
{
    cin>>N;
    for (int i=0; i<N; i++){
        long long a, b;
        cin>>a>>b;
        v[i]={a, b};
    }
    sort(v, v+N);
    for (int i=0; i<N; i++){
        S=v[i].second;
        minid=v[i].first;
        maxid=v[i].first;
        maxi=max(maxi, (S-(maxid-minid)));
        for (int j=i+1; j<N; j++){
            S+=v[j].second;
            maxid=max(maxid, v[j].first);
            minid=min(minid, v[j].first);
            maxi=max(maxi, (S-(maxid-minid)));
        }
    }
    cout<<maxi;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 27 ms 340 KB Output is correct
28 Correct 27 ms 340 KB Output is correct
29 Correct 30 ms 340 KB Output is correct
30 Correct 29 ms 460 KB Output is correct
31 Correct 26 ms 372 KB Output is correct
32 Correct 26 ms 384 KB Output is correct
33 Correct 26 ms 356 KB Output is correct
34 Correct 25 ms 376 KB Output is correct
35 Correct 27 ms 368 KB Output is correct
36 Correct 26 ms 308 KB Output is correct
37 Correct 25 ms 376 KB Output is correct
38 Correct 25 ms 360 KB Output is correct
39 Correct 34 ms 340 KB Output is correct
40 Correct 29 ms 340 KB Output is correct
41 Correct 29 ms 340 KB Output is correct
42 Correct 26 ms 360 KB Output is correct
43 Correct 29 ms 360 KB Output is correct
44 Correct 26 ms 380 KB Output is correct
45 Correct 26 ms 340 KB Output is correct
46 Correct 25 ms 316 KB Output is correct
47 Correct 25 ms 340 KB Output is correct
48 Correct 25 ms 356 KB Output is correct
49 Correct 34 ms 360 KB Output is correct
50 Correct 29 ms 376 KB Output is correct
51 Correct 28 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 27 ms 340 KB Output is correct
28 Correct 27 ms 340 KB Output is correct
29 Correct 30 ms 340 KB Output is correct
30 Correct 29 ms 460 KB Output is correct
31 Correct 26 ms 372 KB Output is correct
32 Correct 26 ms 384 KB Output is correct
33 Correct 26 ms 356 KB Output is correct
34 Correct 25 ms 376 KB Output is correct
35 Correct 27 ms 368 KB Output is correct
36 Correct 26 ms 308 KB Output is correct
37 Correct 25 ms 376 KB Output is correct
38 Correct 25 ms 360 KB Output is correct
39 Correct 34 ms 340 KB Output is correct
40 Correct 29 ms 340 KB Output is correct
41 Correct 29 ms 340 KB Output is correct
42 Correct 26 ms 360 KB Output is correct
43 Correct 29 ms 360 KB Output is correct
44 Correct 26 ms 380 KB Output is correct
45 Correct 26 ms 340 KB Output is correct
46 Correct 25 ms 316 KB Output is correct
47 Correct 25 ms 340 KB Output is correct
48 Correct 25 ms 356 KB Output is correct
49 Correct 34 ms 360 KB Output is correct
50 Correct 29 ms 376 KB Output is correct
51 Correct 28 ms 340 KB Output is correct
52 Execution timed out 1087 ms 8080 KB Time limit exceeded
53 Halted 0 ms 0 KB -