From db965ce2fac7d154538cb122540d29b4ddaeba90 Mon Sep 17 00:00:00 2001 From: oncsr Date: Fri, 8 Aug 2025 19:26:16 +0900 Subject: [PATCH] =?UTF-8?q?[20250808]=20BOJ=20/=20P3=20/=20=EC=9D=BC?= =?UTF-8?q?=EA=B8=B0=EC=98=88=EB=B3=B4=20/=20=EA=B6=8C=ED=98=81=EC=A4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...74\352\270\260\354\230\210\353\263\264.md" | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 "khj20006/202508/08 BOJ P3 \354\235\274\352\270\260\354\230\210\353\263\264.md" 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<