diff --git "a/khj20006/202508/08 BOJ P3 \354\235\274\352\270\260\354\230\210\353\263\264.md" "b/khj20006/202508/08 BOJ P3 \354\235\274\352\270\260\354\230\210\353\263\264.md" new file mode 100644 index 00000000..29bbf30a --- /dev/null +++ "b/khj20006/202508/08 BOJ P3 \354\235\274\352\270\260\354\230\210\353\263\264.md" @@ -0,0 +1,60 @@ +```cpp +#include +#include +#include +using namespace std; +using namespace __gnu_pbds; + +using ll = long long; +using pbds = tree, rb_tree_tag, tree_order_statistics_node_update>; + +pbds os; +ll a[100001]{}; +int N, M; + +void remove(ll v) { + os.erase(os.find_by_order(os.order_of_key(v))); +} + +int main(){ + cin.tie(0)->sync_with_stdio(0); + + cin>>N>>M; + for(int i=1;i<=N;i++) { + cin>>a[i]; + os.insert(a[i]); + } + + for(;M--;) { + int o; + cin>>o; + if(o <= 2) { + int i; + ll x; + cin>>i>>x; + x *= o == 1 ? 1 : -1; + remove(a[i]); + a[i] += x; + os.insert(a[i]); + } + else if(o == 3) { + ll l, r; + cin>>l>>r; + cout<>t; + t = N-t+1; + ll s = 0, e = 2e15, m = (s+e+1)>>1; + while(s>1; + } + cout<