제출 #624100

#제출 시각아이디문제언어결과실행 시간메모리
624100HanksburgerSimple game (IZhO17_game)C++17
0 / 100
2 ms4180 KiB
#include <bits/stdc++.h> using namespace std; int bit[1000005], a[100005]; void update(int x, int y) { for (int i=x; i<=1e6; i+=i&(-i)) bit[i]+=y; } int query(int x) { int ans=0; for (int i=x; i; i-=i&(-i)) ans+=bit[i]; return ans; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; for (int i=1; i<=n; i++) { cin >> a[i]; update(a[i], 1); } for (int i=1; i<=m; i++) { int t; cin >> t; if (t==1) { int x, y; cin >> x >> y; update(a[x], -1); a[x]=y; update(a[x], 1); } else { int x; cin >> x; cout << query(x) << '\n'; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...