Submission #475141

#TimeUsernameProblemLanguageResultExecution timeMemory
475141ismoilovSimple game (IZhO17_game)C++14
0 / 100
1 ms460 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); const int maxx = 2e5; int tr[4*maxx]; int n; void add(int x, int v){ while(x <= n){ tr[x] += v; x += (x & -x); } } int sum(int x){ int s = 0; while(x > 0){ s += tr[x]; x -= (x & -x); } return s; } void S() { int m; cin >> n >> m; vector <int> a(n+1); for(int i = 1; i <= n; i ++){ cin >> a[i]; add(a[i], 1); } for(int i = 0; i < m; i ++){ int x; cin >> x; if(x == 1){ int c, b; cin >> c >> b; add(a[c], -1); add(b, 1); } else{ int b; cin >> b; cout << sum(b) << "\n"; } } } int main() { IOS; /*int t; cin >> t; while(t --)*/ S(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...