답안 #77287

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
77287 2018-09-24T17:28:58 Z MohamedAhmed0 Art Exhibition (JOI18_art) C++14
50 / 100
1000 ms 36928 KB
#include <bits/stdc++.h>

using namespace std;

long long dp[500001] ;

int main()
{
    long long n ;
    cin>>n ;
    map<long long , long long>mp ;
    for(long long i = 0 ; i < n ; ++i)
    {
        long long x , y ;
        cin>>x>>y;
        mp[x] += y ;
    }
    vector< pair<long long , long long> >vp ;
    for(auto &i : mp)
      vp.push_back({i.first , i.second});
    long long ans = vp[0].second;
    dp[0] = vp[0].second;
    for(long long i = 1 ; i < vp.size() ; ++i)
    {
       dp[i] = max(vp[i].second , vp[i].second + dp[i-1] - (vp[i].first - vp[i-1].first));
       ans = max(ans , dp[i]);
    }
    cout<<ans<<"\n";
    return 0 ;
}

Compilation message

art.cpp: In function 'int main()':
art.cpp:23:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(long long i = 1 ; i < vp.size() ; ++i)
                           ~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 372 KB Output is correct
3 Correct 2 ms 400 KB Output is correct
4 Correct 2 ms 544 KB Output is correct
5 Correct 2 ms 544 KB Output is correct
6 Correct 2 ms 544 KB Output is correct
7 Correct 2 ms 544 KB Output is correct
8 Correct 2 ms 544 KB Output is correct
9 Correct 2 ms 576 KB Output is correct
10 Correct 2 ms 576 KB Output is correct
11 Correct 2 ms 608 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 372 KB Output is correct
3 Correct 2 ms 400 KB Output is correct
4 Correct 2 ms 544 KB Output is correct
5 Correct 2 ms 544 KB Output is correct
6 Correct 2 ms 544 KB Output is correct
7 Correct 2 ms 544 KB Output is correct
8 Correct 2 ms 544 KB Output is correct
9 Correct 2 ms 576 KB Output is correct
10 Correct 2 ms 576 KB Output is correct
11 Correct 2 ms 608 KB Output is correct
12 Correct 2 ms 612 KB Output is correct
13 Correct 2 ms 652 KB Output is correct
14 Correct 2 ms 660 KB Output is correct
15 Correct 3 ms 672 KB Output is correct
16 Correct 3 ms 676 KB Output is correct
17 Correct 2 ms 684 KB Output is correct
18 Correct 2 ms 684 KB Output is correct
19 Correct 3 ms 700 KB Output is correct
20 Correct 3 ms 700 KB Output is correct
21 Correct 2 ms 760 KB Output is correct
22 Correct 3 ms 760 KB Output is correct
23 Correct 3 ms 760 KB Output is correct
24 Correct 2 ms 760 KB Output is correct
25 Correct 2 ms 760 KB Output is correct
26 Correct 2 ms 760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 372 KB Output is correct
3 Correct 2 ms 400 KB Output is correct
4 Correct 2 ms 544 KB Output is correct
5 Correct 2 ms 544 KB Output is correct
6 Correct 2 ms 544 KB Output is correct
7 Correct 2 ms 544 KB Output is correct
8 Correct 2 ms 544 KB Output is correct
9 Correct 2 ms 576 KB Output is correct
10 Correct 2 ms 576 KB Output is correct
11 Correct 2 ms 608 KB Output is correct
12 Correct 2 ms 612 KB Output is correct
13 Correct 2 ms 652 KB Output is correct
14 Correct 2 ms 660 KB Output is correct
15 Correct 3 ms 672 KB Output is correct
16 Correct 3 ms 676 KB Output is correct
17 Correct 2 ms 684 KB Output is correct
18 Correct 2 ms 684 KB Output is correct
19 Correct 3 ms 700 KB Output is correct
20 Correct 3 ms 700 KB Output is correct
21 Correct 2 ms 760 KB Output is correct
22 Correct 3 ms 760 KB Output is correct
23 Correct 3 ms 760 KB Output is correct
24 Correct 2 ms 760 KB Output is correct
25 Correct 2 ms 760 KB Output is correct
26 Correct 2 ms 760 KB Output is correct
27 Correct 17 ms 1276 KB Output is correct
28 Correct 18 ms 1332 KB Output is correct
29 Correct 11 ms 1404 KB Output is correct
30 Correct 10 ms 1404 KB Output is correct
31 Correct 10 ms 1404 KB Output is correct
32 Correct 10 ms 1404 KB Output is correct
33 Correct 9 ms 1404 KB Output is correct
34 Correct 10 ms 1404 KB Output is correct
35 Correct 10 ms 1404 KB Output is correct
36 Correct 10 ms 1404 KB Output is correct
37 Correct 9 ms 1404 KB Output is correct
38 Correct 11 ms 1404 KB Output is correct
39 Correct 10 ms 1404 KB Output is correct
40 Correct 10 ms 1404 KB Output is correct
41 Correct 9 ms 1460 KB Output is correct
42 Correct 10 ms 1460 KB Output is correct
43 Correct 15 ms 1460 KB Output is correct
44 Correct 15 ms 1460 KB Output is correct
45 Correct 12 ms 1460 KB Output is correct
46 Correct 16 ms 1460 KB Output is correct
47 Correct 9 ms 1460 KB Output is correct
48 Correct 10 ms 1460 KB Output is correct
49 Correct 10 ms 1460 KB Output is correct
50 Correct 9 ms 1460 KB Output is correct
51 Correct 9 ms 1460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 372 KB Output is correct
3 Correct 2 ms 400 KB Output is correct
4 Correct 2 ms 544 KB Output is correct
5 Correct 2 ms 544 KB Output is correct
6 Correct 2 ms 544 KB Output is correct
7 Correct 2 ms 544 KB Output is correct
8 Correct 2 ms 544 KB Output is correct
9 Correct 2 ms 576 KB Output is correct
10 Correct 2 ms 576 KB Output is correct
11 Correct 2 ms 608 KB Output is correct
12 Correct 2 ms 612 KB Output is correct
13 Correct 2 ms 652 KB Output is correct
14 Correct 2 ms 660 KB Output is correct
15 Correct 3 ms 672 KB Output is correct
16 Correct 3 ms 676 KB Output is correct
17 Correct 2 ms 684 KB Output is correct
18 Correct 2 ms 684 KB Output is correct
19 Correct 3 ms 700 KB Output is correct
20 Correct 3 ms 700 KB Output is correct
21 Correct 2 ms 760 KB Output is correct
22 Correct 3 ms 760 KB Output is correct
23 Correct 3 ms 760 KB Output is correct
24 Correct 2 ms 760 KB Output is correct
25 Correct 2 ms 760 KB Output is correct
26 Correct 2 ms 760 KB Output is correct
27 Correct 17 ms 1276 KB Output is correct
28 Correct 18 ms 1332 KB Output is correct
29 Correct 11 ms 1404 KB Output is correct
30 Correct 10 ms 1404 KB Output is correct
31 Correct 10 ms 1404 KB Output is correct
32 Correct 10 ms 1404 KB Output is correct
33 Correct 9 ms 1404 KB Output is correct
34 Correct 10 ms 1404 KB Output is correct
35 Correct 10 ms 1404 KB Output is correct
36 Correct 10 ms 1404 KB Output is correct
37 Correct 9 ms 1404 KB Output is correct
38 Correct 11 ms 1404 KB Output is correct
39 Correct 10 ms 1404 KB Output is correct
40 Correct 10 ms 1404 KB Output is correct
41 Correct 9 ms 1460 KB Output is correct
42 Correct 10 ms 1460 KB Output is correct
43 Correct 15 ms 1460 KB Output is correct
44 Correct 15 ms 1460 KB Output is correct
45 Correct 12 ms 1460 KB Output is correct
46 Correct 16 ms 1460 KB Output is correct
47 Correct 9 ms 1460 KB Output is correct
48 Correct 10 ms 1460 KB Output is correct
49 Correct 10 ms 1460 KB Output is correct
50 Correct 9 ms 1460 KB Output is correct
51 Correct 9 ms 1460 KB Output is correct
52 Execution timed out 1075 ms 36928 KB Time limit exceeded
53 Halted 0 ms 0 KB -