From 8cf3625d029ce87156793ab129674c706acf4776 Mon Sep 17 00:00:00 2001 From: ShazidMahsrafi Date: Thu, 21 Dec 2023 02:06:46 +0600 Subject: [PATCH] add 1913C --- Codes/1913C Game with Multiset/1913C.cpp | 89 ++++++++++++++++++++++++ Readme.md | 1 + 2 files changed, 90 insertions(+) create mode 100644 Codes/1913C Game with Multiset/1913C.cpp diff --git a/Codes/1913C Game with Multiset/1913C.cpp b/Codes/1913C Game with Multiset/1913C.cpp new file mode 100644 index 0000000..e09cedc --- /dev/null +++ b/Codes/1913C Game with Multiset/1913C.cpp @@ -0,0 +1,89 @@ +#include +using namespace std; + +// Short forms +#define int long long +#define ll long long +#define endl '\n' +#define ff first +#define ss second +#define pb push_back +#define all(x) x.begin(), x.end() +#define sz(x) (int)(x).size() + +// Outputs +#define yes cout<<"YES"< void _print(pair p); +template void _print(vector v);template void _print(set v); +template void _print(map v);template void _print(multiset v); +template void _print(pair p) {cerr << "{"; _print(p.first); cerr << ","; _print(p.second); cerr << "}";} +template void _print(vector v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} +template void _print(set v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} +template void _print(multiset v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} +template void _print(unordered_set v) {cerr<<"[ "; for(T i : v) {_print(i); cerr<<" ";} cerr<<"]";} +template void _print(map v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";} +template void _print(multimap v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";} +template void _print(unordered_map v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void solve() +{ + int n; + cin>>n; + vectorv(31,0); + for(int i=0; i>t>>x; + if(t==1) + v[x]++; + else + { + for(int j=29; j>=0; --j) + { + int mx=min(x>>j,v[j]); + x -= mx*(1<> TC; + while (TC--) solve(); +} \ No newline at end of file diff --git a/Readme.md b/Readme.md index e0f46ef..0b57273 100644 --- a/Readme.md +++ b/Readme.md @@ -210,6 +210,7 @@ This repository contains my solutions of Codeforces problems. They are in C++ la | 1912L | LOL Lovers | [Question](https://codeforces.com/problemset/problem/1912/L) | [Solution] | 1913A | Rating Increase | [Question](https://codeforces.com/problemset/problem/1913/A) | [Solution] | 1913B | Swap and Delete | [Question](https://codeforces.com/problemset/problem/1913/B) | [Solution] +| 1913C | Game with Multiset | [Question](https://codeforces.com/problemset/problem/1913/C) | [Solution] | 1914A | Problemsolving Log | [Question](https://codeforces.com/problemset/problem/1914/A) | [Solution] | 1914B | Preparing for the Contest | [Question](https://codeforces.com/problemset/problem/1914/B) | [Solution] | 1914C | Quests | [Question](https://codeforces.com/problemset/problem/1914/C) | [Solution]