답안 #699362

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
699362 2023-02-16T16:44:03 Z AmrT Art Exhibition (JOI18_art) C++14
50 / 100
1000 ms 12904 KB
#include <bits/stdc++.h>
#define lop(i,a,b) for(ll i = a; i < b; i++)
#define alop(i,v) for(auto i: v)
#define ll long long
#define all(v) v.begin(),v.end()
#define pb push_back
using namespace std;
int main(){
    ll n, t1, t2; cin >> n;
    ll arr[n];
    vector<pair<ll,ll>> v, m;

    lop(i,0,n){
        cin >> t1 >> t2;
        v.pb({t1,t2});
    }
    sort(all(v));
    int i = 0;
    alop(it,v){
        if(i == 0) arr[0] = it.second;
        else arr[i] = it.second + arr[i-1];
        i++;
    }
    ll mx = -1e18;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(i+j >= n) break;
            ll sum = arr[i+j];
            if(j == 0) mx = max(mx, sum - arr[i+j-1]);
            else{
                if(i != 0) sum -= arr[i-1];
                mx = max(mx, sum - (v[i+j].first - v[i].first));
            }
        }
    }
    cout << mx;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 308 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 308 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 304 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 304 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 340 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 304 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 308 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 304 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 304 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 340 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 304 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 21 ms 592 KB Output is correct
28 Correct 22 ms 596 KB Output is correct
29 Correct 21 ms 604 KB Output is correct
30 Correct 20 ms 648 KB Output is correct
31 Correct 21 ms 564 KB Output is correct
32 Correct 21 ms 596 KB Output is correct
33 Correct 27 ms 572 KB Output is correct
34 Correct 21 ms 596 KB Output is correct
35 Correct 21 ms 600 KB Output is correct
36 Correct 26 ms 596 KB Output is correct
37 Correct 21 ms 596 KB Output is correct
38 Correct 21 ms 596 KB Output is correct
39 Correct 20 ms 668 KB Output is correct
40 Correct 21 ms 596 KB Output is correct
41 Correct 21 ms 596 KB Output is correct
42 Correct 21 ms 668 KB Output is correct
43 Correct 21 ms 596 KB Output is correct
44 Correct 20 ms 568 KB Output is correct
45 Correct 20 ms 596 KB Output is correct
46 Correct 25 ms 596 KB Output is correct
47 Correct 26 ms 604 KB Output is correct
48 Correct 22 ms 596 KB Output is correct
49 Correct 24 ms 632 KB Output is correct
50 Correct 21 ms 568 KB Output is correct
51 Correct 21 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 308 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 304 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 304 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 340 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 304 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 21 ms 592 KB Output is correct
28 Correct 22 ms 596 KB Output is correct
29 Correct 21 ms 604 KB Output is correct
30 Correct 20 ms 648 KB Output is correct
31 Correct 21 ms 564 KB Output is correct
32 Correct 21 ms 596 KB Output is correct
33 Correct 27 ms 572 KB Output is correct
34 Correct 21 ms 596 KB Output is correct
35 Correct 21 ms 600 KB Output is correct
36 Correct 26 ms 596 KB Output is correct
37 Correct 21 ms 596 KB Output is correct
38 Correct 21 ms 596 KB Output is correct
39 Correct 20 ms 668 KB Output is correct
40 Correct 21 ms 596 KB Output is correct
41 Correct 21 ms 596 KB Output is correct
42 Correct 21 ms 668 KB Output is correct
43 Correct 21 ms 596 KB Output is correct
44 Correct 20 ms 568 KB Output is correct
45 Correct 20 ms 596 KB Output is correct
46 Correct 25 ms 596 KB Output is correct
47 Correct 26 ms 604 KB Output is correct
48 Correct 22 ms 596 KB Output is correct
49 Correct 24 ms 632 KB Output is correct
50 Correct 21 ms 568 KB Output is correct
51 Correct 21 ms 596 KB Output is correct
52 Execution timed out 1093 ms 12904 KB Time limit exceeded
53 Halted 0 ms 0 KB -