# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1128751 | raisel | Simple game (IZhO17_game) | C++20 | 2 ms | 320 KiB |
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#define forn for(int i=1;i<=n;i++)
#define Yes cout<<"YES\n"
#define No cout<<"NO\n"
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define pb push_back
#define sp setprecision
#define int long long
#define ll long long
#define nn '\n'
using namespace std;
const int N=1e6+26;
const int MOD=1e9+7;
int a[N];
int n,m;
void al(){
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>a[i];
}
while(m--){
int type;
cin>>type;
if(type==1){
int x,y;
cin>>x>>y;
a[x]=y;
}
else {
int x;
cin>>x;
int cnt=0;
for(int i=1;i<n;i++){
if((a[i]<=x && a[i+1]>=x) || (a[i]>=x && a[i+1]<=x)) cnt++;
}
cout<<cnt<<'\n';
}
}
}
signed main(){
freopen("game.in","r",stdin);
freopen("game.out","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t=1;
// cin>>t;
while(t--) {
al();
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |