aboutsummaryrefslogtreecommitdiff
path: root/contests/Round849/G2Joe
diff options
context:
space:
mode:
Diffstat (limited to 'contests/Round849/G2Joe')
-rwxr-xr-xcontests/Round849/G2Joe/main.cpp129
-rw-r--r--contests/Round849/G2Joe/main_input0.txt21
-rw-r--r--contests/Round849/G2Joe/main_input1.txt3
-rw-r--r--contests/Round849/G2Joe/main_input2.txt3
-rw-r--r--contests/Round849/G2Joe/main_output0.txt10
-rw-r--r--contests/Round849/G2Joe/main_output1.txt1
-rw-r--r--contests/Round849/G2Joe/main_output2.txt1
7 files changed, 0 insertions, 168 deletions
diff --git a/contests/Round849/G2Joe/main.cpp b/contests/Round849/G2Joe/main.cpp
deleted file mode 100755
index bdfd50e..0000000
--- a/contests/Round849/G2Joe/main.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-#include<bits/stdc++.h>
-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 pb push_back
-#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};
-
-//pretty printing
-template<typename K, typename V>
-void printm(const map<K, V> &mp) {
- cerr << "{" << endl;
- for (auto p : mp) {
- cerr << " { " << p.first << " : " << p.second << " }\n";
- }
- cerr << "}" << endl;
-}
-template<typename T>
-void printv(const vector<T> &v) {
- cerr << "[";
- for (int i = 0; i < v.size(); i++) {
- if (i == v.size() - 1) {
- cerr << v[i];
- } else {
- cerr << v[i] << ", ";
- }
- }
- cerr << "]\n";
-}
-
-template<typename T>
-void printvv(const vector<vector<T>> &v) {
- cerr << "[\n";
- for (auto &vec : v) {
- cout << " ";
- printv(vec);
- }
- cerr << "]\n";
-}
-void print() {
- cerr << "\n";
-}
-
-template<typename T, typename... TS>
-void print(T val, TS... vals) {
- cerr << val << " ";
- print(vals...);
-}
-
-
-/* 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
- */
-
-void solve() {
- int n, c;
- cin >> n >> c;
- vector<int> a(n);
- for (int i = 0; i < n; i++) {
- cin >> a[i];
- }
- vector<int> s(n), e(n);
- multiset<int> ms;
- for (int i = 0; i < n; i++) {
- s[i] = a[i] + i + 1;
- e[i] = a[i] + n - i;
- ms.insert(s[i]);
- }
- vector<pair<int, int>> x(n);
- for (int i = 0; i < n; i++) {
- if (s[i] <= e[i]) {
- x[i] = {s[i], -s[i]};
- } else {
- x[i] = {e[i], s[i]};
- }
- }
- sort(x.begin(), x.end());
- int ans = 0;
- bool found = false;
- while (ans < n && c - x[ans].first >= 0) {
- c -= x[ans].first;
- ms.erase(ms.find(abs(x[ans].second)));
- if (x[ans].second < 0) {
- found = true;
- }
- ans += 1;
- }
- if (found) {
- cout << ans << '\n';
- } else {
- while (*ms.begin() > c && ans >= 0) {
- c += x[ans - 1].first;
- ms.insert(abs(x[ans - 1].second));
- ans -= 1;
- }
- cout << ans + 1 << '\n';
- }
-}
-
-int main () {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- int tt;
- cin >> tt;
- while(tt--) {
- solve();
- }
-}
-
diff --git a/contests/Round849/G2Joe/main_input0.txt b/contests/Round849/G2Joe/main_input0.txt
deleted file mode 100644
index a76b8f7..0000000
--- a/contests/Round849/G2Joe/main_input0.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-10
-5 6
-1 1 1 1 1
-8 32
-100 52 13 6 9 4 100 35
-1 1
-5
-4 5
-4 3 2 1
-5 9
-2 3 1 4 1
-5 8
-2 3 1 4 1
-4 3
-2 3 4 1
-4 9
-5 4 3 3
-2 14
-7 5
-5 600000000
-500000000 400000000 300000000 200000000 100000000
diff --git a/contests/Round849/G2Joe/main_input1.txt b/contests/Round849/G2Joe/main_input1.txt
deleted file mode 100644
index 66160b6..0000000
--- a/contests/Round849/G2Joe/main_input1.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-2 5
-4 2 \ No newline at end of file
diff --git a/contests/Round849/G2Joe/main_input2.txt b/contests/Round849/G2Joe/main_input2.txt
deleted file mode 100644
index b579a0a..0000000
--- a/contests/Round849/G2Joe/main_input2.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-3 4
-5 5 1 \ No newline at end of file
diff --git a/contests/Round849/G2Joe/main_output0.txt b/contests/Round849/G2Joe/main_output0.txt
deleted file mode 100644
index 83eaaf6..0000000
--- a/contests/Round849/G2Joe/main_output0.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-2
-3
-0
-1
-3
-2
-1
-1
-2
-2
diff --git a/contests/Round849/G2Joe/main_output1.txt b/contests/Round849/G2Joe/main_output1.txt
deleted file mode 100644
index 56a6051..0000000
--- a/contests/Round849/G2Joe/main_output1.txt
+++ /dev/null
@@ -1 +0,0 @@
-1 \ No newline at end of file
diff --git a/contests/Round849/G2Joe/main_output2.txt b/contests/Round849/G2Joe/main_output2.txt
deleted file mode 100644
index 56a6051..0000000
--- a/contests/Round849/G2Joe/main_output2.txt
+++ /dev/null
@@ -1 +0,0 @@
-1 \ No newline at end of file