Submission #886294

#TimeUsernameProblemLanguageResultExecution timeMemory
886294boris_mihovSimple game (IZhO17_game)C++17
22 / 100
1061 ms1116 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...