답안 #912690

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
912690 2024-01-19T18:03:46 Z andro Pismo (COCI18_pismo) C++14
0 / 70
11 ms 3420 KB
#include <bits/stdc++.h>

#define int long long

#define double long double

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    vector<int> suf_max(n + 2);
    vector<int> suf_min(n + 2, 1e18);
    int ans = 1e18;
    for(int i = n; i > 0; i--) {
        suf_max[i] = max(suf_max[i + 1], a[i]);
        suf_min[i] = min(suf_min[i + 1], a[i]);
    }
    for(int i = n - 1; i > 0; i--) {
        ans = min(ans, suf_max[i] - suf_min[i]);
    }
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Incorrect 1 ms 512 KB Output isn't correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Incorrect 9 ms 3420 KB Output isn't correct
6 Incorrect 9 ms 3420 KB Output isn't correct
7 Incorrect 11 ms 3340 KB Output isn't correct