답안 #85250

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
85250 2018-11-19T01:49:31 Z mra2322001 Simple game (IZhO17_game) C++14
22 / 100
1000 ms 1976 KB
#include <bits/stdc++.h>
#define f0(i, n) for(int i(0); i < (n); i++)
#define f1(i, n) for(int i(1); i <= n; i++)

using namespace std;
typedef long long ll;
const int N = 100002;

int n, q, a[N];

void solve(){
    int h; cin >> h;
    int res = 0;
    f1(i, n - 1){
        if(a[i] < h && a[i + 1] > h) res++;
        if(a[i] > h && a[i + 1] < h) res++;
    }
    cout << res << endl;
}

int main(){
    ios_base::sync_with_stdio(0);

    cin >> n >> q;
    f1(i, n) cin >> a[i];
    while(q--){
        int type; cin >> type;
        if(type==2) solve();
        else{
            int i, x; cin >> i >> x;
            a[i] = x;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 5 ms 644 KB Output is correct
4 Correct 5 ms 808 KB Output is correct
5 Correct 5 ms 888 KB Output is correct
6 Correct 6 ms 888 KB Output is correct
7 Correct 5 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 5 ms 644 KB Output is correct
4 Correct 5 ms 808 KB Output is correct
5 Correct 5 ms 888 KB Output is correct
6 Correct 6 ms 888 KB Output is correct
7 Correct 5 ms 888 KB Output is correct
8 Execution timed out 1075 ms 1976 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 5 ms 644 KB Output is correct
4 Correct 5 ms 808 KB Output is correct
5 Correct 5 ms 888 KB Output is correct
6 Correct 6 ms 888 KB Output is correct
7 Correct 5 ms 888 KB Output is correct
8 Execution timed out 1075 ms 1976 KB Time limit exceeded
9 Halted 0 ms 0 KB -