답안 #1029664

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1029664 2024-07-21T07:43:18 Z jnjwnwnw 지구 온난화 (NOI13_gw) C++17
23 / 40
318 ms 26520 KB
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define ll long long
#define fff(i, a, b) for(ll i = a; i < b; i++)

#define MAXN 1000006

bool sim[MAXN];

int main(){
    ll n; cin >> n;
    vector<pair<ll, ll>> v;
    fff(i, 0, n){
        ll a; cin >> a;
        v.emplace_back(a, i+1);
    }
    sort(v.rbegin(), v.rend());
    // fff(i, 0, n){
    //     cout << v[i].first << " " << v[i].second << endl;
    // } cout << endl;
    ll best = 0;
    ll cur = 0;
    fff(i, 0, n){
        auto [h, j] = v[i];
        sim[j] = 1;
        cur++;
        if (sim[j+1]) cur--;
        if (sim[j-1]) cur--;
        if (cur > best) best = cur;
    }
    cout << best << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 2764 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 3280 KB Output is correct
2 Correct 21 ms 3184 KB Output is correct
3 Correct 34 ms 3276 KB Output is correct
4 Correct 29 ms 3192 KB Output is correct
5 Correct 35 ms 3280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 313 ms 26472 KB Output is correct
2 Correct 301 ms 26520 KB Output is correct
3 Correct 315 ms 26400 KB Output is correct
4 Correct 318 ms 26512 KB Output is correct
5 Correct 317 ms 25748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 313 ms 25756 KB Output is correct
2 Correct 296 ms 25852 KB Output is correct
3 Correct 300 ms 25752 KB Output is correct
4 Incorrect 187 ms 20000 KB Output isn't correct
5 Halted 0 ms 0 KB -