답안 #722639

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
722639 2023-04-12T13:38:05 Z AndrijaM Art Exhibition (JOI18_art) C++14
100 / 100
558 ms 21048 KB
#include <bits/stdc++.h>

using ll=long long;

using namespace std;

int main()
{
    long long n;
    cin>>n;
    long long s,v;
    vector<pair<long long,long long>>x;
    for(long long i=0;i<n;i++)
    {
        cin>>s>>v;
        x.push_back({s,v});
    }
    sort(x.begin(),x.end());
    long long ans=0;
    long long mx=0;
    for(long long i=0;i<n;i++)
    {
        if(i==0)
        {
            mx=x[i].first+x[i].second;
            ans=max(ans, mx-x[i].first);
        }
        else
        {
            mx=max(mx+x[i].second,x[i].second+x[i].first);
            ans=max(ans, mx-x[i].first);
        }
    }
    cout<<ans<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 224 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 224 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 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 308 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 304 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 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 224 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 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 308 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 304 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 8 ms 568 KB Output is correct
28 Correct 6 ms 596 KB Output is correct
29 Correct 6 ms 596 KB Output is correct
30 Correct 6 ms 596 KB Output is correct
31 Correct 6 ms 636 KB Output is correct
32 Correct 6 ms 548 KB Output is correct
33 Correct 6 ms 564 KB Output is correct
34 Correct 7 ms 596 KB Output is correct
35 Correct 6 ms 596 KB Output is correct
36 Correct 6 ms 596 KB Output is correct
37 Correct 5 ms 564 KB Output is correct
38 Correct 6 ms 644 KB Output is correct
39 Correct 7 ms 564 KB Output is correct
40 Correct 7 ms 544 KB Output is correct
41 Correct 6 ms 552 KB Output is correct
42 Correct 8 ms 572 KB Output is correct
43 Correct 6 ms 596 KB Output is correct
44 Correct 6 ms 596 KB Output is correct
45 Correct 6 ms 556 KB Output is correct
46 Correct 5 ms 524 KB Output is correct
47 Correct 6 ms 596 KB Output is correct
48 Correct 6 ms 552 KB Output is correct
49 Correct 6 ms 568 KB Output is correct
50 Correct 6 ms 596 KB Output is correct
51 Correct 6 ms 568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 224 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 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 308 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 304 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 8 ms 568 KB Output is correct
28 Correct 6 ms 596 KB Output is correct
29 Correct 6 ms 596 KB Output is correct
30 Correct 6 ms 596 KB Output is correct
31 Correct 6 ms 636 KB Output is correct
32 Correct 6 ms 548 KB Output is correct
33 Correct 6 ms 564 KB Output is correct
34 Correct 7 ms 596 KB Output is correct
35 Correct 6 ms 596 KB Output is correct
36 Correct 6 ms 596 KB Output is correct
37 Correct 5 ms 564 KB Output is correct
38 Correct 6 ms 644 KB Output is correct
39 Correct 7 ms 564 KB Output is correct
40 Correct 7 ms 544 KB Output is correct
41 Correct 6 ms 552 KB Output is correct
42 Correct 8 ms 572 KB Output is correct
43 Correct 6 ms 596 KB Output is correct
44 Correct 6 ms 596 KB Output is correct
45 Correct 6 ms 556 KB Output is correct
46 Correct 5 ms 524 KB Output is correct
47 Correct 6 ms 596 KB Output is correct
48 Correct 6 ms 552 KB Output is correct
49 Correct 6 ms 568 KB Output is correct
50 Correct 6 ms 596 KB Output is correct
51 Correct 6 ms 568 KB Output is correct
52 Correct 545 ms 20800 KB Output is correct
53 Correct 518 ms 20784 KB Output is correct
54 Correct 518 ms 21028 KB Output is correct
55 Correct 517 ms 21048 KB Output is correct
56 Correct 495 ms 20924 KB Output is correct
57 Correct 513 ms 21008 KB Output is correct
58 Correct 533 ms 20924 KB Output is correct
59 Correct 508 ms 20916 KB Output is correct
60 Correct 508 ms 20984 KB Output is correct
61 Correct 493 ms 20716 KB Output is correct
62 Correct 534 ms 20936 KB Output is correct
63 Correct 551 ms 20912 KB Output is correct
64 Correct 528 ms 20908 KB Output is correct
65 Correct 496 ms 20904 KB Output is correct
66 Correct 558 ms 20840 KB Output is correct
67 Correct 536 ms 20988 KB Output is correct
68 Correct 521 ms 20852 KB Output is correct