diff options
| author | omagdy7 <omar.professional8777@gmail.com> | 2023-12-10 15:55:42 +0200 |
|---|---|---|
| committer | omagdy7 <omar.professional8777@gmail.com> | 2023-12-10 15:55:42 +0200 |
| commit | 1ccba7112b334c0887bd349966219b38eb9ccfb9 (patch) | |
| tree | 07be3a04f8bb90569025d2b3a89d48d373333566 /contests/Round828 | |
| parent | beb36b3d4f757bd5ecb9746265926c9f8830b0ab (diff) | |
| download | competitive-programming-1ccba7112b334c0887bd349966219b38eb9ccfb9.tar.xz competitive-programming-1ccba7112b334c0887bd349966219b38eb9ccfb9.zip | |
Removed some empty problems and solved 2 problems in rust
Diffstat (limited to 'contests/Round828')
| -rwxr-xr-x | contests/Round828/E/main.cpp | 79 | ||||
| -rwxr-xr-x | contests/Round828/Round#828/A/main.cpp | 39 | ||||
| -rwxr-xr-x | contests/Round828/Round#828/B/main.cpp | 48 | ||||
| -rwxr-xr-x | contests/Round828/Round#828/B/main_input0.txt | 27 | ||||
| -rwxr-xr-x | contests/Round828/Round#828/B/main_output0.txt | 18 | ||||
| -rwxr-xr-x | contests/Round828/Round#828/C/main.cpp | 48 | ||||
| -rwxr-xr-x | contests/Round828/Round#828/C/main_input0.txt | 13 | ||||
| -rwxr-xr-x | contests/Round828/Round#828/C/main_output0.txt | 6 | ||||
| -rwxr-xr-x | contests/Round828/Round#828/D/main.cpp | 20 | ||||
| -rwxr-xr-x | contests/Round828/Round#828/E/main.cpp | 20 | ||||
| -rwxr-xr-x | contests/Round828/Round#828/F/main.cpp | 20 |
11 files changed, 0 insertions, 338 deletions
diff --git a/contests/Round828/E/main.cpp b/contests/Round828/E/main.cpp deleted file mode 100755 index 68691f8..0000000 --- a/contests/Round828/E/main.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include <bits/stdc++.h> -#include <tuple> - -using namespace std; - -using ll = long long; -using pi = pair<int, int>; -using vpi = vector<pi>; -using vi = vector<int>; -using vll = vector<long long>; -using mpii = map<int, int>; -using mpll = map<ll, ll>; -using db = long double; - -#define push_back pb -#define all(x) (x).begin(), (x).end() -#define rall(x) (x).rbegin(), (x).rend() -#define lb lower_bound -#define ub upper_bound - -const int MOD = (int)1e9 + 7; -const db PI = acos((db)-1); -const int dx[4]{1, 0, -1, 0}; -const int dy[4]{0, 1, 0, -1}; - -auto helper(vi &v) { - ll ans = 0, zc = 0; - for (int i = v.size() - 1; i >= 0; i--) { - (v[i] == 0 ? zc++ : ans += zc); - } - return ans; -} - -void solve() { - int n; - cin >> n; - vi v(n), v1(n), v2(n); - for (int i = 0; i < n; i++) { - cin >> v[i]; - } - v1 = v; - v2 = v; - for (auto &x : v1) { - if (x == 0) { - x = 1; - break; - } - } - for (int i = n - 1; i >= 0; i--) { - if (v2[i] == 1) { - v2[i] = 0; - break; - } - } - ll og = helper(v); - ll l = helper(v1); - ll r = helper(v2); - cout << max(og, max(r, l)) << '\n'; -} - -int main() { - ios_base::sync_with_stdio(false); - cin.tie(NULL); - int tt; - cin >> tt; - while (tt--) { - solve(); - } -} - -/* stuff you should look for: - --------------------------- - * special cases (n=1?) - * int overflow, array bounds - * do smth instead of nothing and stay organized - * WRITE STUFF DOWN - * DON'T GET STUCK ON ONE APPROACH - */ - diff --git a/contests/Round828/Round#828/A/main.cpp b/contests/Round828/Round#828/A/main.cpp deleted file mode 100755 index 62a742b..0000000 --- a/contests/Round828/Round#828/A/main.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -typedef long long ll; -typedef pair<int, int> ii; -typedef vector<ii> vii; -typedef vector<int> vi; - -#define INF 1000000000 - -string buildString(map<int, char> &mp, vi &v) { - string s = ""; - for (auto x : v) { - s.push_back(mp[x]); - } - return s; -} - -int main () { - ios_base::sync_with_stdio(false); - cin.tie(NULL); - int tt; - cin >> tt; - while(tt--) { - int n; - cin >> n; - vi v(n); - for (auto &x : v) cin >> x; - string s; - cin >> s; - map<int, char> mp; - for (int i = 0; i < n; i++) { - mp[v[i]] = s[i]; - } - // cerr << buildString(mp,v) << '\n'; - cout << (s == buildString(mp, v) ? "YES" : "NO") << '\n'; - } -} diff --git a/contests/Round828/Round#828/B/main.cpp b/contests/Round828/Round#828/B/main.cpp deleted file mode 100755 index e2d3d5d..0000000 --- a/contests/Round828/Round#828/B/main.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -typedef long long ll; -typedef pair<int, int> ii; -typedef vector<ii> vii; -typedef vector<int> vi; - -#define INF 1000000000 - -int main () { - ios_base::sync_with_stdio(false); - cin.tie(NULL); - int tt; - cin >> tt; - while(tt--) { - int n, q; - cin >> n >> q; - vector<long long> v(n); - int even = 0, odd = 0; - long long ans = 0; - for (int i = 0 ; i < n; i++) { - cin >> v[i]; - odd += (v[i] & 1); - ans += v[i]; - } - even = n - odd; - while (q--) { - int t, x; - cin >> t >> x; - if (t == 0) { - ans += even * x; - if (x & 1) { - odd += even; - even = 0; - } - } else { - ans += odd * x; - if (x & 1) { - even += odd; - odd = 0; - } - } - cout << ans << '\n'; - } - } -} diff --git a/contests/Round828/Round#828/B/main_input0.txt b/contests/Round828/Round#828/B/main_input0.txt deleted file mode 100755 index 2a62cb5..0000000 --- a/contests/Round828/Round#828/B/main_input0.txt +++ /dev/null @@ -1,27 +0,0 @@ -4 -1 1 -1 -1 1 -3 3 -1 2 4 -0 2 -1 3 -0 5 -6 7 -1 3 2 4 10 48 -1 6 -0 5 -0 4 -0 5 -1 3 -0 12 -0 1 -6 7 -1000000000 1000000000 1000000000 11 15 17 -0 17 -1 10000 -1 51 -0 92 -0 53 -1 16 -0 1 diff --git a/contests/Round828/Round#828/B/main_output0.txt b/contests/Round828/Round#828/B/main_output0.txt deleted file mode 100755 index 6427631..0000000 --- a/contests/Round828/Round#828/B/main_output0.txt +++ /dev/null @@ -1,18 +0,0 @@ -2 -11 -14 -29 -80 -100 -100 -100 -118 -190 -196 -3000000094 -3000060094 -3000060400 -3000060952 -3000061270 -3000061366 -3000061366 diff --git a/contests/Round828/Round#828/C/main.cpp b/contests/Round828/Round#828/C/main.cpp deleted file mode 100755 index a69f265..0000000 --- a/contests/Round828/Round#828/C/main.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -int main () { - ios_base::sync_with_stdio(false); - cin.tie(NULL); - int tt; - cin >> tt; - while(tt--) { - int n; - cin >> n; - int m = 0, mx = 0; - for (int i = 0; i < n; i++) { - int x; - cin >> x; - while (x % 2 == 0) { - x /= 2; - m += 1; - } - } - if (m >= n) { - cout << 0 << '\n'; - } else { - int d = n - m, ans = 0; - vector<int> a; - for (int i = n; i >= 1; i--) { - int j = i, cnt = 0; - while (j % 2 == 0) { - cnt += 1; - j /= 2; - } - if (cnt != 0) { - a.push_back(cnt); - } - } - sort(a.rbegin(), a.rend()); - for (int i = 0; i < (int)a.size(); i++) { - ans += 1; - d -= a[i]; - if (d <= 0) { - break; - } - } - cout << (d <= 0 ? ans : -1) << '\n'; - } - } -} diff --git a/contests/Round828/Round#828/C/main_input0.txt b/contests/Round828/Round#828/C/main_input0.txt deleted file mode 100755 index c507f1f..0000000 --- a/contests/Round828/Round#828/C/main_input0.txt +++ /dev/null @@ -1,13 +0,0 @@ -6 -1 -2 -2 -3 2 -3 -10 6 11 -4 -13 17 1 1 -5 -1 1 12 1 1 -6 -20 7 14 18 3 5
\ No newline at end of file diff --git a/contests/Round828/Round#828/C/main_output0.txt b/contests/Round828/Round#828/C/main_output0.txt deleted file mode 100755 index 994d708..0000000 --- a/contests/Round828/Round#828/C/main_output0.txt +++ /dev/null @@ -1,6 +0,0 @@ -0 -1 -1 --1 -2 -1
\ No newline at end of file diff --git a/contests/Round828/Round#828/D/main.cpp b/contests/Round828/Round#828/D/main.cpp deleted file mode 100755 index 8b6b654..0000000 --- a/contests/Round828/Round#828/D/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -typedef long long ll; -typedef pair<int, int> ii; -typedef vector<ii> vii; -typedef vector<int> vi; - -#define INF 1000000000 - -int main () { - ios_base::sync_with_stdio(false); - cin.tie(NULL); - int tt; - cin >> tt; - while(tt--) { - - } -} diff --git a/contests/Round828/Round#828/E/main.cpp b/contests/Round828/Round#828/E/main.cpp deleted file mode 100755 index 8b6b654..0000000 --- a/contests/Round828/Round#828/E/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -typedef long long ll; -typedef pair<int, int> ii; -typedef vector<ii> vii; -typedef vector<int> vi; - -#define INF 1000000000 - -int main () { - ios_base::sync_with_stdio(false); - cin.tie(NULL); - int tt; - cin >> tt; - while(tt--) { - - } -} diff --git a/contests/Round828/Round#828/F/main.cpp b/contests/Round828/Round#828/F/main.cpp deleted file mode 100755 index 8b6b654..0000000 --- a/contests/Round828/Round#828/F/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -typedef long long ll; -typedef pair<int, int> ii; -typedef vector<ii> vii; -typedef vector<int> vi; - -#define INF 1000000000 - -int main () { - ios_base::sync_with_stdio(false); - cin.tie(NULL); - int tt; - cin >> tt; - while(tt--) { - - } -} |
