답안 #995936

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
995936 2024-06-10T04:53:20 Z yanb Art Exhibition (JOI18_art) C++14
30 / 100
1000 ms 604 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define pii pair<long long, long long>

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    vector<pii> ab(n);
    for (int i = 0; i < n; i++) cin >> ab[i].first >> ab[i].second;
    sort(ab.begin(), ab.end());
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) {
        a[i] = ab[i].first;
        b[i] = ab[i].second;
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
            int tans = 0, mn = 1e16, mx = -1e16;
            for (int k = i; k <= j; k++) {
                tans += b[k];
                mn = min(mn, a[k]);
                mx = max(mx, a[k]);
            }
            ans = max(ans, tans - mx + mn);
        }
    }

    cout << ans << "\n";
}   
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 504 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 504 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 4 ms 348 KB Output is correct
13 Correct 4 ms 348 KB Output is correct
14 Correct 4 ms 348 KB Output is correct
15 Correct 4 ms 348 KB Output is correct
16 Correct 4 ms 348 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 3 ms 348 KB Output is correct
19 Correct 4 ms 460 KB Output is correct
20 Correct 4 ms 344 KB Output is correct
21 Correct 3 ms 348 KB Output is correct
22 Correct 4 ms 348 KB Output is correct
23 Correct 4 ms 348 KB Output is correct
24 Correct 4 ms 348 KB Output is correct
25 Correct 4 ms 348 KB Output is correct
26 Correct 4 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 504 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 4 ms 348 KB Output is correct
13 Correct 4 ms 348 KB Output is correct
14 Correct 4 ms 348 KB Output is correct
15 Correct 4 ms 348 KB Output is correct
16 Correct 4 ms 348 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 3 ms 348 KB Output is correct
19 Correct 4 ms 460 KB Output is correct
20 Correct 4 ms 344 KB Output is correct
21 Correct 3 ms 348 KB Output is correct
22 Correct 4 ms 348 KB Output is correct
23 Correct 4 ms 348 KB Output is correct
24 Correct 4 ms 348 KB Output is correct
25 Correct 4 ms 348 KB Output is correct
26 Correct 4 ms 468 KB Output is correct
27 Execution timed out 1077 ms 604 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 504 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 4 ms 348 KB Output is correct
13 Correct 4 ms 348 KB Output is correct
14 Correct 4 ms 348 KB Output is correct
15 Correct 4 ms 348 KB Output is correct
16 Correct 4 ms 348 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 3 ms 348 KB Output is correct
19 Correct 4 ms 460 KB Output is correct
20 Correct 4 ms 344 KB Output is correct
21 Correct 3 ms 348 KB Output is correct
22 Correct 4 ms 348 KB Output is correct
23 Correct 4 ms 348 KB Output is correct
24 Correct 4 ms 348 KB Output is correct
25 Correct 4 ms 348 KB Output is correct
26 Correct 4 ms 468 KB Output is correct
27 Execution timed out 1077 ms 604 KB Time limit exceeded
28 Halted 0 ms 0 KB -