답안 #886294

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
886294 2023-12-11T18:44:38 Z boris_mihov Simple game (IZhO17_game) C++17
22 / 100
1000 ms 1116 KB
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <bitset>
#include <vector>

typedef long long llong;
const int MAXN = 100000 + 10;

int n, q;
int a[MAXN];

void solve()
{
    for (int i = 1 ; i <= n ; ++i)
    {
        int qType, pos, val;
        std::cin >> qType;

        if (qType == 1)
        {
            std::cin >> pos >> a[pos];
            continue;
        }

        int count = 0;
        std::cin >> val;
        for (int j = 2 ; j <= n ; ++j)
        {
            if ((a[j] >= val) ^ (a[j - 1] >= val)) 
            {
                count++;
            }
        }

        std::cout << count << '\n';
    }
}

void input()
{
    std::cin >> n >> q;
    for (int i = 1 ; i <= n ; ++i)
    {
        std::cin >> a[i];
    }
}

void fastIOI()
{
    std::ios_base :: sync_with_stdio(0);
    std::cout.tie(nullptr);
    std::cin.tie(nullptr);
}

int main()
{
    fastIOI();
    input();
    solve();

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Execution timed out 1061 ms 1116 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Execution timed out 1061 ms 1116 KB Time limit exceeded
9 Halted 0 ms 0 KB -