답안 #116642

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
116642 2019-06-13T09:59:03 Z roseanne_pcy Art Exhibition (JOI18_art) C++14
100 / 100
253 ms 32768 KB
//Power Of Ninja Go
#include <bits/stdc++.h>
//#ifdef atom #else #endif
using namespace std;
typedef long long ll; typedef pair<ll, ll> ii; typedef vector<int> vi; typedef vector< ii > vii;
#define X first
#define Y second
#define pb push_back
vii pong;
const int maxn = 5e5+5;
ll qs[maxn];
ll x[maxn], y[maxn];
int main()
{
    int n; scanf("%d", &n);
    for(int i = 0; i< n; i++)
    {
        pong.pb(ii());
        scanf("%lld %lld", &pong.back().X, &pong.back().Y);
    }
    sort(pong.begin(), pong.end());
    for(int i = 1; i<= n; i++)
    {
        qs[i] = qs[i-1] + pong[i-1].Y;
    }
    for(int i = 1; i<= n; i++) x[i] = qs[i]-pong[i-1].X;
    for(int i = 1; i<= n; i++) y[i] = qs[i-1]-pong[i-1].X;
    //for(int i = 1; i<= n; i++) cout << x[i] << " " << y[i] << endl;
    ll best = 1e18;
    ll res = -1e18;
    for(int i = 1; i<= n; i++)
    {
        best = min(best, y[i]);
        res = max(res, x[i]-best);
    }
    printf("%lld\n", res);
}

Compilation message

art.cpp: In function 'int main()':
art.cpp:15:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int n; scanf("%d", &n);
            ~~~~~^~~~~~~~~~
art.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld", &pong.back().X, &pong.back().Y);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 512 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 8 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 512 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 8 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 5 ms 768 KB Output is correct
28 Correct 4 ms 768 KB Output is correct
29 Correct 5 ms 760 KB Output is correct
30 Correct 5 ms 768 KB Output is correct
31 Correct 4 ms 768 KB Output is correct
32 Correct 4 ms 768 KB Output is correct
33 Correct 4 ms 768 KB Output is correct
34 Correct 4 ms 768 KB Output is correct
35 Correct 5 ms 768 KB Output is correct
36 Correct 5 ms 768 KB Output is correct
37 Correct 4 ms 768 KB Output is correct
38 Correct 4 ms 768 KB Output is correct
39 Correct 4 ms 768 KB Output is correct
40 Correct 4 ms 768 KB Output is correct
41 Correct 4 ms 768 KB Output is correct
42 Correct 4 ms 768 KB Output is correct
43 Correct 4 ms 768 KB Output is correct
44 Correct 7 ms 768 KB Output is correct
45 Correct 5 ms 768 KB Output is correct
46 Correct 4 ms 768 KB Output is correct
47 Correct 5 ms 768 KB Output is correct
48 Correct 5 ms 768 KB Output is correct
49 Correct 5 ms 768 KB Output is correct
50 Correct 4 ms 768 KB Output is correct
51 Correct 5 ms 808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 512 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 8 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 5 ms 768 KB Output is correct
28 Correct 4 ms 768 KB Output is correct
29 Correct 5 ms 760 KB Output is correct
30 Correct 5 ms 768 KB Output is correct
31 Correct 4 ms 768 KB Output is correct
32 Correct 4 ms 768 KB Output is correct
33 Correct 4 ms 768 KB Output is correct
34 Correct 4 ms 768 KB Output is correct
35 Correct 5 ms 768 KB Output is correct
36 Correct 5 ms 768 KB Output is correct
37 Correct 4 ms 768 KB Output is correct
38 Correct 4 ms 768 KB Output is correct
39 Correct 4 ms 768 KB Output is correct
40 Correct 4 ms 768 KB Output is correct
41 Correct 4 ms 768 KB Output is correct
42 Correct 4 ms 768 KB Output is correct
43 Correct 4 ms 768 KB Output is correct
44 Correct 7 ms 768 KB Output is correct
45 Correct 5 ms 768 KB Output is correct
46 Correct 4 ms 768 KB Output is correct
47 Correct 5 ms 768 KB Output is correct
48 Correct 5 ms 768 KB Output is correct
49 Correct 5 ms 768 KB Output is correct
50 Correct 4 ms 768 KB Output is correct
51 Correct 5 ms 808 KB Output is correct
52 Correct 232 ms 32576 KB Output is correct
53 Correct 230 ms 32640 KB Output is correct
54 Correct 237 ms 32652 KB Output is correct
55 Correct 240 ms 32620 KB Output is correct
56 Correct 247 ms 32592 KB Output is correct
57 Correct 253 ms 32692 KB Output is correct
58 Correct 241 ms 32720 KB Output is correct
59 Correct 242 ms 32684 KB Output is correct
60 Correct 249 ms 32720 KB Output is correct
61 Correct 241 ms 32464 KB Output is correct
62 Correct 235 ms 32680 KB Output is correct
63 Correct 232 ms 32720 KB Output is correct
64 Correct 233 ms 32768 KB Output is correct
65 Correct 244 ms 32592 KB Output is correct
66 Correct 237 ms 32656 KB Output is correct
67 Correct 242 ms 32712 KB Output is correct
68 Correct 238 ms 32708 KB Output is correct