답안 #50708

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
50708 2018-06-13T03:14:03 Z ayhcbagnop Art Exhibition (JOI18_art) C++14
100 / 100
301 ms 239072 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 3 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 472 KB Output is correct
4 Correct 3 ms 476 KB Output is correct
5 Correct 2 ms 640 KB Output is correct
6 Correct 2 ms 640 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 2 ms 680 KB Output is correct
9 Correct 2 ms 792 KB Output is correct
10 Correct 3 ms 792 KB Output is correct
11 Correct 3 ms 792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 472 KB Output is correct
4 Correct 3 ms 476 KB Output is correct
5 Correct 2 ms 640 KB Output is correct
6 Correct 2 ms 640 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 2 ms 680 KB Output is correct
9 Correct 2 ms 792 KB Output is correct
10 Correct 3 ms 792 KB Output is correct
11 Correct 3 ms 792 KB Output is correct
12 Correct 3 ms 792 KB Output is correct
13 Correct 3 ms 792 KB Output is correct
14 Correct 2 ms 864 KB Output is correct
15 Correct 2 ms 864 KB Output is correct
16 Correct 2 ms 864 KB Output is correct
17 Correct 3 ms 864 KB Output is correct
18 Correct 2 ms 864 KB Output is correct
19 Correct 2 ms 864 KB Output is correct
20 Correct 2 ms 960 KB Output is correct
21 Correct 2 ms 960 KB Output is correct
22 Correct 2 ms 960 KB Output is correct
23 Correct 2 ms 960 KB Output is correct
24 Correct 2 ms 960 KB Output is correct
25 Correct 2 ms 960 KB Output is correct
26 Correct 2 ms 960 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 472 KB Output is correct
4 Correct 3 ms 476 KB Output is correct
5 Correct 2 ms 640 KB Output is correct
6 Correct 2 ms 640 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 2 ms 680 KB Output is correct
9 Correct 2 ms 792 KB Output is correct
10 Correct 3 ms 792 KB Output is correct
11 Correct 3 ms 792 KB Output is correct
12 Correct 3 ms 792 KB Output is correct
13 Correct 3 ms 792 KB Output is correct
14 Correct 2 ms 864 KB Output is correct
15 Correct 2 ms 864 KB Output is correct
16 Correct 2 ms 864 KB Output is correct
17 Correct 3 ms 864 KB Output is correct
18 Correct 2 ms 864 KB Output is correct
19 Correct 2 ms 864 KB Output is correct
20 Correct 2 ms 960 KB Output is correct
21 Correct 2 ms 960 KB Output is correct
22 Correct 2 ms 960 KB Output is correct
23 Correct 2 ms 960 KB Output is correct
24 Correct 2 ms 960 KB Output is correct
25 Correct 2 ms 960 KB Output is correct
26 Correct 2 ms 960 KB Output is correct
27 Correct 6 ms 1400 KB Output is correct
28 Correct 5 ms 1476 KB Output is correct
29 Correct 5 ms 1640 KB Output is correct
30 Correct 6 ms 1732 KB Output is correct
31 Correct 5 ms 1860 KB Output is correct
32 Correct 5 ms 1992 KB Output is correct
33 Correct 5 ms 2116 KB Output is correct
34 Correct 5 ms 2244 KB Output is correct
35 Correct 5 ms 2372 KB Output is correct
36 Correct 5 ms 2536 KB Output is correct
37 Correct 5 ms 2700 KB Output is correct
38 Correct 5 ms 2828 KB Output is correct
39 Correct 5 ms 2864 KB Output is correct
40 Correct 5 ms 3032 KB Output is correct
41 Correct 5 ms 3192 KB Output is correct
42 Correct 6 ms 3228 KB Output is correct
43 Correct 5 ms 3392 KB Output is correct
44 Correct 5 ms 3520 KB Output is correct
45 Correct 4 ms 3648 KB Output is correct
46 Correct 5 ms 3776 KB Output is correct
47 Correct 5 ms 3904 KB Output is correct
48 Correct 5 ms 4064 KB Output is correct
49 Correct 4 ms 4160 KB Output is correct
50 Correct 4 ms 4292 KB Output is correct
51 Correct 4 ms 4416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 472 KB Output is correct
4 Correct 3 ms 476 KB Output is correct
5 Correct 2 ms 640 KB Output is correct
6 Correct 2 ms 640 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 2 ms 680 KB Output is correct
9 Correct 2 ms 792 KB Output is correct
10 Correct 3 ms 792 KB Output is correct
11 Correct 3 ms 792 KB Output is correct
12 Correct 3 ms 792 KB Output is correct
13 Correct 3 ms 792 KB Output is correct
14 Correct 2 ms 864 KB Output is correct
15 Correct 2 ms 864 KB Output is correct
16 Correct 2 ms 864 KB Output is correct
17 Correct 3 ms 864 KB Output is correct
18 Correct 2 ms 864 KB Output is correct
19 Correct 2 ms 864 KB Output is correct
20 Correct 2 ms 960 KB Output is correct
21 Correct 2 ms 960 KB Output is correct
22 Correct 2 ms 960 KB Output is correct
23 Correct 2 ms 960 KB Output is correct
24 Correct 2 ms 960 KB Output is correct
25 Correct 2 ms 960 KB Output is correct
26 Correct 2 ms 960 KB Output is correct
27 Correct 6 ms 1400 KB Output is correct
28 Correct 5 ms 1476 KB Output is correct
29 Correct 5 ms 1640 KB Output is correct
30 Correct 6 ms 1732 KB Output is correct
31 Correct 5 ms 1860 KB Output is correct
32 Correct 5 ms 1992 KB Output is correct
33 Correct 5 ms 2116 KB Output is correct
34 Correct 5 ms 2244 KB Output is correct
35 Correct 5 ms 2372 KB Output is correct
36 Correct 5 ms 2536 KB Output is correct
37 Correct 5 ms 2700 KB Output is correct
38 Correct 5 ms 2828 KB Output is correct
39 Correct 5 ms 2864 KB Output is correct
40 Correct 5 ms 3032 KB Output is correct
41 Correct 5 ms 3192 KB Output is correct
42 Correct 6 ms 3228 KB Output is correct
43 Correct 5 ms 3392 KB Output is correct
44 Correct 5 ms 3520 KB Output is correct
45 Correct 4 ms 3648 KB Output is correct
46 Correct 5 ms 3776 KB Output is correct
47 Correct 5 ms 3904 KB Output is correct
48 Correct 5 ms 4064 KB Output is correct
49 Correct 4 ms 4160 KB Output is correct
50 Correct 4 ms 4292 KB Output is correct
51 Correct 4 ms 4416 KB Output is correct
52 Correct 271 ms 36464 KB Output is correct
53 Correct 271 ms 49100 KB Output is correct
54 Correct 275 ms 61748 KB Output is correct
55 Correct 275 ms 74396 KB Output is correct
56 Correct 278 ms 87136 KB Output is correct
57 Correct 272 ms 100056 KB Output is correct
58 Correct 273 ms 112656 KB Output is correct
59 Correct 278 ms 125388 KB Output is correct
60 Correct 277 ms 137828 KB Output is correct
61 Correct 289 ms 150396 KB Output is correct
62 Correct 301 ms 163088 KB Output is correct
63 Correct 272 ms 175816 KB Output is correct
64 Correct 268 ms 188484 KB Output is correct
65 Correct 296 ms 201100 KB Output is correct
66 Correct 284 ms 213748 KB Output is correct
67 Correct 275 ms 226412 KB Output is correct
68 Correct 294 ms 239072 KB Output is correct