# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
142890 | 2019-08-12T01:30:01 Z | Lawliet | Simple game (IZhO17_game) | C++14 | 5 ms | 380 KB |
#include <bits/stdc++.h> #define MAX 1010 using namespace std; int n, m; int n1, n2, n3; int v[MAX]; int main() { scanf("%d %d",&n,&m); for(int g = 1 ; g <= n ; g++) scanf("%d",&v[g]); for(int g = 0 ; g < m ; g++) { scanf("%d %d",&n1,&n2); if(n1 == 1) { scanf("%d",&n3); v[ n2 ] = n3; } else { if(n == 1) { printf("0\n"); continue; } int ans = 0; if(v[ 1 ] > n2 && v[ 2 ] < n2) ans++; if(v[ n ] > n2 && v[ n - 1 ] < n2) ans++; for(int h = 2 ; h < n ; h++) { if(v[ h ] > n2 && v[h - 1] < n2) ans++; if(v[ h ] > n2 && v[h + 1] < n2) ans++; } printf("%d\n",ans); } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 376 KB | Output is correct |
3 | Correct | 4 ms | 256 KB | Output is correct |
4 | Correct | 4 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 4 ms | 376 KB | Output is correct |
7 | Correct | 4 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 376 KB | Output is correct |
3 | Correct | 4 ms | 256 KB | Output is correct |
4 | Correct | 4 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 4 ms | 376 KB | Output is correct |
7 | Correct | 4 ms | 376 KB | Output is correct |
8 | Incorrect | 2 ms | 380 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 376 KB | Output is correct |
3 | Correct | 4 ms | 256 KB | Output is correct |
4 | Correct | 4 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 4 ms | 376 KB | Output is correct |
7 | Correct | 4 ms | 376 KB | Output is correct |
8 | Incorrect | 2 ms | 380 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |