답안 #1049869

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1049869 2024-08-09T05:50:50 Z vjudge1 Art Exhibition (JOI18_art) C++
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
int main()
{
    int n;
    cin >> n;
    pair<long long,long long> a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i].f >> a[i].s;
    }
    sort(a, a + n);
    long long m = 0;
    for (int i = 0; i < n; i++) {
        long long mx = a[i].f, mn = a[i].f, r = 0;
        for (int j = i; j < n; j++) {
            if (a[j].f - mx < a[j].s) {
                r += a[j].s - (a[j].f - mx);
                if (a[j].f > mx) mx = a[j].f;
            }
        }
        m = max(m, r);
    }
    cout << m;
}

Compilation message

art.cpp: In function 'int main()':
art.cpp:16:32: warning: unused variable 'mn' [-Wunused-variable]
   16 |         long long mx = a[i].f, mn = a[i].f, r = 0;
      |                                ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -