# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
878408 | 2023-11-24T10:18:16 Z | prince | Simple game (IZhO17_game) | C++17 | 1000 ms | 1252 KB |
#include "bits/stdc++.h" using namespace std; using ll = long long; /*void dfs(int u){ vis[u]=true; cout<<u<<" "; for(int v:g[u]){ if(vis[v])continue; dfs(v); } }*/ void solve(){ int n,q;cin>>n>>q; vector<pair<int,int>>pr(n); for(int i=0;i<n;i++){ cin>>pr[i].second; pr[i].first=i+1; } while(q--){ int r;cin>>r; if(r==1){ int a,b;cin>>a>>b; pr[a-1].second=b; } else{ int cnt=0; int c;cin>>c; for(int i=0;i<pr.size()-1;i++){ if(min(pr[i].second,pr[i+1].second)<=c&&max(pr[i].second,pr[i+1].second)>=c)cnt++; } cout<<cnt<<endl; } } } signed main() { cin.tie(0)->sync_with_stdio(false); #ifdef prince freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int q = 1; // cin >> q; while (q--) { solve(); cout << '\n'; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 2 ms | 412 KB | Output is correct |
3 | Correct | 2 ms | 348 KB | Output is correct |
4 | Correct | 2 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 2 ms | 348 KB | Output is correct |
7 | Correct | 3 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 2 ms | 412 KB | Output is correct |
3 | Correct | 2 ms | 348 KB | Output is correct |
4 | Correct | 2 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 2 ms | 348 KB | Output is correct |
7 | Correct | 3 ms | 348 KB | Output is correct |
8 | Execution timed out | 1092 ms | 1252 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 2 ms | 412 KB | Output is correct |
3 | Correct | 2 ms | 348 KB | Output is correct |
4 | Correct | 2 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 2 ms | 348 KB | Output is correct |
7 | Correct | 3 ms | 348 KB | Output is correct |
8 | Execution timed out | 1092 ms | 1252 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |