# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
72951 | 2018-08-27T09:38:04 Z | win11905 | Simple game (IZhO17_game) | C++11 | 167 ms | 5540 KB |
#include <bits/stdc++.h> using namespace std; const int N = 1e5+5; const int MX = 1e6; int n, m, A[N]; int t[MX]; void update(int x, int v) { for(; x <= MX; x += x & -x) t[x-1] += v; } int query(int x) { int v = 0; for(; x; x -= x & -x) v += t[x-1]; return v; } int main() { scanf("%d %d", &n, &m); for(int i = 1; i <= n; ++i) scanf("%d", A+i); for(int i = 1; i < n; ++i) { update(min(A[i], A[i+1]), 1); update(1+max(A[i], A[i+1]), -1); } for(int i = 0, a, b, c; i < m; ++i) { scanf("%d %d", &a, &b); if(a == 1) { scanf("%d", &c); if(b != 1) { update(min(A[b], A[b-1]), -1); update(1+max(A[b], A[b-1]), 1); update(min(c, A[b-1]), 1); update(1+max(c, A[b-1]), -1); } if(b != n) { update(min(A[b], A[b+1]), -1); update(1+max(A[b], A[b+1]), 1); update(min(c, A[b+1]), 1); update(1+max(c, A[b+1]), -1); } A[b] = c; } else printf("%d\n", query(b)); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 6 ms | 4048 KB | Output is correct |
3 | Correct | 7 ms | 4144 KB | Output is correct |
4 | Correct | 7 ms | 4176 KB | Output is correct |
5 | Correct | 6 ms | 4176 KB | Output is correct |
6 | Correct | 6 ms | 4176 KB | Output is correct |
7 | Correct | 4 ms | 4176 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 6 ms | 4048 KB | Output is correct |
3 | Correct | 7 ms | 4144 KB | Output is correct |
4 | Correct | 7 ms | 4176 KB | Output is correct |
5 | Correct | 6 ms | 4176 KB | Output is correct |
6 | Correct | 6 ms | 4176 KB | Output is correct |
7 | Correct | 4 ms | 4176 KB | Output is correct |
8 | Correct | 54 ms | 4176 KB | Output is correct |
9 | Correct | 72 ms | 5396 KB | Output is correct |
10 | Correct | 78 ms | 5540 KB | Output is correct |
11 | Correct | 53 ms | 5540 KB | Output is correct |
12 | Correct | 66 ms | 5540 KB | Output is correct |
13 | Correct | 59 ms | 5540 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 6 ms | 4048 KB | Output is correct |
3 | Correct | 7 ms | 4144 KB | Output is correct |
4 | Correct | 7 ms | 4176 KB | Output is correct |
5 | Correct | 6 ms | 4176 KB | Output is correct |
6 | Correct | 6 ms | 4176 KB | Output is correct |
7 | Correct | 4 ms | 4176 KB | Output is correct |
8 | Correct | 54 ms | 4176 KB | Output is correct |
9 | Correct | 72 ms | 5396 KB | Output is correct |
10 | Correct | 78 ms | 5540 KB | Output is correct |
11 | Correct | 53 ms | 5540 KB | Output is correct |
12 | Correct | 66 ms | 5540 KB | Output is correct |
13 | Correct | 59 ms | 5540 KB | Output is correct |
14 | Correct | 97 ms | 5540 KB | Output is correct |
15 | Correct | 101 ms | 5540 KB | Output is correct |
16 | Correct | 110 ms | 5540 KB | Output is correct |
17 | Correct | 114 ms | 5540 KB | Output is correct |
18 | Correct | 167 ms | 5540 KB | Output is correct |