답안 #877834

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
877834 2023-11-23T17:21:46 Z Susanna Simple game (IZhO17_game) C++14
22 / 100
1000 ms 1720 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

void solve(){
    ll n, m; cin >> n >> m;
    vector<ll> v(n);
    for(ll i = 0; i < n; ++i){
        cin >> v[i];
    }
    ll ans = 0;
    while(m--){
        ll pos; cin >> pos;
        if(pos == 1){
            ll a, b; cin >> a >> b;
            v[a - 1] = b;
            
        }
        else{
            ans = 0;
            ll k; cin >> k;
            for(ll i = 0; i < n - 1; ++i){
                if((v[i] <= k && v[i + 1] >= k)||(v[i] >= k && v[i + 1] <= k)){
                    ans++;
                }
            }
        cout << ans << "\n";
        }
    }
}


int main() {
    solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Execution timed out 1065 ms 1720 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Execution timed out 1065 ms 1720 KB Time limit exceeded
9 Halted 0 ms 0 KB -