답안 #886293

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

typedef long long llong;
const int MAXS = 250000 + 10;
const int MAXN = 500 + 10;
const int MOD  = 1e9 + 13;

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 Runtime error 1 ms 604 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 1 ms 604 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 1 ms 604 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -