답안 #592923

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
592923 2022-07-09T20:06:56 Z PMPRR Simple game (IZhO17_game) C++17
0 / 100
845 ms 262144 KB
#include <bits/stdc++.h>
#define pb push_back
#define MAXN 100010
using namespace std;

std::vector<int> v;
multiset<int> ms;
int main(){
    int n,m; cin >> n >> m;
    v.pb(0);
    for(int i=1;i<=n;i++){
        int a; cin >> a;
        v.pb(a);
        //cout << "v[" << i << "]= "<< v[i] << endl;
        for(int j = v[i-1];j<a;j++){
            ms.insert(j);
        }
        
    }
    bool is1gone = false;
    for(int i=0;i<m;i++){
        int a; cin >> a;
        //cout << "a: " << a << endl;
        if(a == 1){
            int b,c; cin >> b >> c;
            v[b] = c;
            is1gone = true;
        }
        if(a == 2){
            int b; cin >> b;
            int resp = 0;
            if(is1gone == false) resp = ms.count(b)+1;
            else{
                for(int j=2;j<=n;j++){
                    if(v[j] >= b && v[j-1] <= b) resp++;
                    if(v[j-1] >= b && v[j] <= b) resp++;
                }
            }
            printf("%d\n",resp);
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 845 ms 262144 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 845 ms 262144 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 845 ms 262144 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -