Submission #990594

# Submission time Handle Problem Language Result Execution time Memory
990594 2024-05-30T17:00:59 Z tch1cherin Simple game (IZhO17_game) C++17
22 / 100
1000 ms 1316 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> h(N);
  for (int &value : h) {
    cin >> value;
  }
  while (M--) {
    int type;
    cin >> type;
    if (type == 1) {
      int pos, val;
      cin >> pos >> val;
      h[--pos] = val;
    } else {
      int H;
      cin >> H;
      int answer = 0;
      for (int i = 0; i < N - 1; i++) {
        if (h[i] < h[i + 1]) {
          answer += h[i] <= H && H <= h[i + 1];
        } else {
          answer += h[i + 1] <= H && H <= h[i];
        }
      }
      cout << answer << "\n";
    }
  }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Execution timed out 1036 ms 1316 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Execution timed out 1036 ms 1316 KB Time limit exceeded
9 Halted 0 ms 0 KB -