답안 #924660

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
924660 2024-02-09T11:30:56 Z sleepntsheep 지구 온난화 (NOI13_gw) C++17
23 / 40
189 ms 12244 KB
#include <iostream>
#include <numeric>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <cstring>
#include <vector>
#include <algorithm>
#include <deque>
#include <set>
#include <utility>
#include <array>
#include <complex>

using u32 = unsigned;
using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;

using namespace std;
using pt = complex<f80>;
#define ALL(x) begin(x), end(x)
#define ShinLena cin.tie(nullptr)->sync_with_stdio(false);
#define N 1000005

int n, a[N], f[N], b[N] ,c ,z;

int main()
{
    ShinLena;
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    iota(b, b+1+n, 0);
    sort(b+1, b+1+n, [](int i, int j){ return a[i] > a[j]; });
    if (a[b[1]] > 0) z = 1;

    for (int i = 1; i <= n; ++i)
    {
        int j = b[i];

        if (j > 1 and j < n)
        {
            if (!f[j-1] and !f[j+1]) ++c;
            else if (f[j-1] and f[j+1]) --c;
        }
        else if (j == 1)
        {if (!f[j+1]) ++c;}
        else if (j == n)
        {if (!f[j-1]) ++c;}

        if (i == n or a[j] != a[b[i]+1]) z = max(z, c);
        f[j] = 1;
    }

    cout << z;

    return 0;
}


# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 5008 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 4956 KB Output is correct
2 Correct 11 ms 5076 KB Output is correct
3 Correct 16 ms 5208 KB Output is correct
4 Correct 20 ms 4952 KB Output is correct
5 Correct 17 ms 5212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 180 ms 12112 KB Output is correct
2 Correct 181 ms 12112 KB Output is correct
3 Correct 189 ms 12232 KB Output is correct
4 Correct 182 ms 11984 KB Output is correct
5 Correct 180 ms 12172 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 184 ms 12244 KB Output isn't correct
2 Halted 0 ms 0 KB -