From 6b548332bfc6469756526002971c422f43f86d0a Mon Sep 17 00:00:00 2001 From: omagdy7 Date: Mon, 24 Jul 2023 13:11:33 +0300 Subject: Removed some empty *.cpp files and Solved some new problems --- contests/Round887/A/main | Bin 0 -> 21080 bytes contests/Round887/A/main.cpp | 152 +++++++++++++++++++++++++++++++++ contests/Round887/A/main_input0.txt | 9 ++ contests/Round887/A/main_output0.txt | 4 + contests/Round887/B/gen.py | 4 + contests/Round887/B/main | Bin 0 -> 16792 bytes contests/Round887/B/main.cpp | 158 +++++++++++++++++++++++++++++++++++ contests/Round887/B/main_input0.txt | 9 ++ contests/Round887/B/main_output0.txt | 8 ++ contests/Round887/C/main.cpp | 129 ++++++++++++++++++++++++++++ contests/Round887/D/main.cpp | 129 ++++++++++++++++++++++++++++ contests/Round887/E/main.cpp | 129 ++++++++++++++++++++++++++++ contests/Round887/F/main.cpp | 129 ++++++++++++++++++++++++++++ 13 files changed, 860 insertions(+) create mode 100755 contests/Round887/A/main create mode 100755 contests/Round887/A/main.cpp create mode 100644 contests/Round887/A/main_input0.txt create mode 100644 contests/Round887/A/main_output0.txt create mode 100644 contests/Round887/B/gen.py create mode 100755 contests/Round887/B/main create mode 100755 contests/Round887/B/main.cpp create mode 100644 contests/Round887/B/main_input0.txt create mode 100644 contests/Round887/B/main_output0.txt create mode 100755 contests/Round887/C/main.cpp create mode 100755 contests/Round887/D/main.cpp create mode 100755 contests/Round887/E/main.cpp create mode 100755 contests/Round887/F/main.cpp (limited to 'contests/Round887') diff --git a/contests/Round887/A/main b/contests/Round887/A/main new file mode 100755 index 0000000..41b5468 Binary files /dev/null and b/contests/Round887/A/main differ diff --git a/contests/Round887/A/main.cpp b/contests/Round887/A/main.cpp new file mode 100755 index 0000000..b645809 --- /dev/null +++ b/contests/Round887/A/main.cpp @@ -0,0 +1,152 @@ +#include +using namespace std; + +using ll = long long; +using pii = pair; +using vpi = vector; +using vi = vector; +using vll = vector; +using mpii = map; +using mpll = map; +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 +#define make_unique(x) \ + sort(all((x))); \ + (x).resize(unique(all((x))) - (x).begin()) +#define ceil(a, b) ((a) + (b) - 1) / (b)) + +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}; + +template +ostream &operator<<(ostream &os, const pair &p); +template ostream &operator<<(ostream &os, const vector &vec); +template +ostream &operator<<(ostream &os, const map &m); +template +ostream &operator<<(ostream &os, const unordered_map &m); +template ostream &operator<<(ostream &os, const set &s); +template +ostream &operator<<(ostream &os, const unordered_set &s); + +template +ostream &operator<<(ostream &os, const pair &p) { + os << "(" << p.first << ", " << p.second << ")"; + return os; +} + +template ostream &operator<<(ostream &os, const vector &vec) { + os << "{"; + for (size_t i = 0; i < vec.size(); ++i) { + if (i > 0) + os << ", "; + os << vec[i]; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const map &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const unordered_map &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template ostream &operator<<(ostream &os, const set &s) { + int i = 0; + os << "{"; + for (const auto &e : s) { + if (i > 0) + os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const unordered_set &s) { + int i = 0; + os << "{"; + for (const auto &e : s) { + if (i > 0) + os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +void dbg() { cerr << "\n"; } + +template void dbg(T val, TS... vals) { + cerr << val << " "; + dbg(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; + cin >> n; + vi v(n); + for (auto &x : v) { + cin >> x; + } + + if (!is_sorted(all(v))) { + cout << 0 << '\n'; + return; + } + int mn = INT_MAX; + for (int i = 0; i < n - 1; i++) { + mn = min(mn, v[i + 1] - v[i]); + } + + if (mn == 0) { + cout << 1 << '\n'; + return; + } + + cout << (mn / 2) + 1 << '\n'; +} + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while (tt--) { + solve(); + } +} diff --git a/contests/Round887/A/main_input0.txt b/contests/Round887/A/main_input0.txt new file mode 100644 index 0000000..b0e13f0 --- /dev/null +++ b/contests/Round887/A/main_input0.txt @@ -0,0 +1,9 @@ +4 +2 +1 1 +4 +1 8 10 13 +3 +1 3 2 +3 +1 9 14 diff --git a/contests/Round887/A/main_output0.txt b/contests/Round887/A/main_output0.txt new file mode 100644 index 0000000..a2c2ab8 --- /dev/null +++ b/contests/Round887/A/main_output0.txt @@ -0,0 +1,4 @@ +1 +2 +0 +3 diff --git a/contests/Round887/B/gen.py b/contests/Round887/B/gen.py new file mode 100644 index 0000000..7cdb534 --- /dev/null +++ b/contests/Round887/B/gen.py @@ -0,0 +1,4 @@ +import sys + +for i in range((int(sys.argv[1]) // 2) + 1): + print(i, int(sys.argv[1]) - i) diff --git a/contests/Round887/B/main b/contests/Round887/B/main new file mode 100755 index 0000000..1ca1e08 Binary files /dev/null and b/contests/Round887/B/main differ diff --git a/contests/Round887/B/main.cpp b/contests/Round887/B/main.cpp new file mode 100755 index 0000000..20406b3 --- /dev/null +++ b/contests/Round887/B/main.cpp @@ -0,0 +1,158 @@ +#include +using namespace std; + +using ll = long long; +using pii = pair; +using vpi = vector; +using vi = vector; +using vll = vector; +using mpii = map; +using mpll = map; +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 +#define make_unique(x) \ + sort(all((x))); \ + (x).resize(unique(all((x))) - (x).begin()) +#define ceil(a, b) ((a) + (b) - 1) / (b)) + +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}; + +template +ostream &operator<<(ostream &os, const pair &p); +template ostream &operator<<(ostream &os, const vector &vec); +template +ostream &operator<<(ostream &os, const map &m); +template +ostream &operator<<(ostream &os, const unordered_map &m); +template ostream &operator<<(ostream &os, const set &s); +template +ostream &operator<<(ostream &os, const unordered_set &s); + +template +ostream &operator<<(ostream &os, const pair &p) { + os << "(" << p.first << ", " << p.second << ")"; + return os; +} + +template ostream &operator<<(ostream &os, const vector &vec) { + os << "{"; + for (size_t i = 0; i < vec.size(); ++i) { + if (i > 0) + os << ", "; + os << vec[i]; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const map &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const unordered_map &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template ostream &operator<<(ostream &os, const set &s) { + int i = 0; + os << "{"; + for (const auto &e : s) { + if (i > 0) + os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const unordered_set &s) { + int i = 0; + os << "{"; + for (const auto &e : s) { + if (i > 0) + os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +void dbg() { cerr << "\n"; } + +template void dbg(T val, TS... vals) { + cerr << val << " "; + dbg(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 + */ + +// 55 34 21 + +int fib(int n, int m) { + int ans = 1; + while (n - m >= 0) { + ans++; + // dbg(n, m); + int tmp = n; + n = m; + m = tmp - n; + } + return ans; +} + +void solve() { + int n, k; + cin >> n >> k; + int ans = 0; + for (int i = 0; i < (n / 2) + 1; i++) { + if (n == 22) { + dbg(n - i, i); + dbg(fib(n - i, i)); + dbg("---------------"); + } + if (fib(n - i, i) >= k - 1) { + ans++; + } + } + cout << ans << '\n'; +} + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while (tt--) { + solve(); + } +} diff --git a/contests/Round887/B/main_input0.txt b/contests/Round887/B/main_input0.txt new file mode 100644 index 0000000..5687cc8 --- /dev/null +++ b/contests/Round887/B/main_input0.txt @@ -0,0 +1,9 @@ +8 +22 4 +3 9 +55 11 +42069 6 +69420 4 +69 1434 +1 3 +1 4 diff --git a/contests/Round887/B/main_output0.txt b/contests/Round887/B/main_output0.txt new file mode 100644 index 0000000..bb5e1c9 --- /dev/null +++ b/contests/Round887/B/main_output0.txt @@ -0,0 +1,8 @@ +4 +0 +1 +1052 +11571 +0 +1 +0 diff --git a/contests/Round887/C/main.cpp b/contests/Round887/C/main.cpp new file mode 100755 index 0000000..20800e5 --- /dev/null +++ b/contests/Round887/C/main.cpp @@ -0,0 +1,129 @@ +#include +using namespace std; + +using ll = long long; +using pii = pair; +using vpi = vector; +using vi = vector; +using vll = vector; +using mpii = map; +using mpll = map; +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 +#define make_unique(x) \ + sort(all((x))); \ + (x).resize(unique(all((x))) - (x).begin()) +#define ceil(a, b) ((a) + (b) - 1) / (b)) + +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}; + +template +ostream &operator<<(ostream &os, const pair &p); +template ostream &operator<<(ostream &os, const vector &vec); +template +ostream &operator<<(ostream &os, const map &m); +template +ostream &operator<<(ostream &os, const unordered_map &m); +template ostream &operator<<(ostream &os, const set &s); +template +ostream &operator<<(ostream &os, const unordered_set &s); + +template +ostream &operator<<(ostream &os, const pair &p) { + os << "(" << p.first << ", " << p.second << ")"; + return os; +} + +template ostream &operator<<(ostream &os, const vector &vec) { + os << "{"; + for (size_t i = 0; i < vec.size(); ++i) { + if (i > 0) + os << ", "; + os << vec[i]; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const map &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const unordered_map &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template ostream &operator<<(ostream &os, const set &s) { + int i = 0; + os << "{"; + for (const auto &e : s) { + if (i > 0) + os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const unordered_set &s) { + int i = 0; + os << "{"; + for (const auto &e : s) { + if (i > 0) + os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +void dbg() { cerr << "\n"; } + +template void dbg(T val, TS... vals) { + cerr << val << " "; + dbg(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 main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while (tt--) { + solve(); + } +} diff --git a/contests/Round887/D/main.cpp b/contests/Round887/D/main.cpp new file mode 100755 index 0000000..20800e5 --- /dev/null +++ b/contests/Round887/D/main.cpp @@ -0,0 +1,129 @@ +#include +using namespace std; + +using ll = long long; +using pii = pair; +using vpi = vector; +using vi = vector; +using vll = vector; +using mpii = map; +using mpll = map; +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 +#define make_unique(x) \ + sort(all((x))); \ + (x).resize(unique(all((x))) - (x).begin()) +#define ceil(a, b) ((a) + (b) - 1) / (b)) + +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}; + +template +ostream &operator<<(ostream &os, const pair &p); +template ostream &operator<<(ostream &os, const vector &vec); +template +ostream &operator<<(ostream &os, const map &m); +template +ostream &operator<<(ostream &os, const unordered_map &m); +template ostream &operator<<(ostream &os, const set &s); +template +ostream &operator<<(ostream &os, const unordered_set &s); + +template +ostream &operator<<(ostream &os, const pair &p) { + os << "(" << p.first << ", " << p.second << ")"; + return os; +} + +template ostream &operator<<(ostream &os, const vector &vec) { + os << "{"; + for (size_t i = 0; i < vec.size(); ++i) { + if (i > 0) + os << ", "; + os << vec[i]; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const map &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const unordered_map &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template ostream &operator<<(ostream &os, const set &s) { + int i = 0; + os << "{"; + for (const auto &e : s) { + if (i > 0) + os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const unordered_set &s) { + int i = 0; + os << "{"; + for (const auto &e : s) { + if (i > 0) + os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +void dbg() { cerr << "\n"; } + +template void dbg(T val, TS... vals) { + cerr << val << " "; + dbg(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 main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while (tt--) { + solve(); + } +} diff --git a/contests/Round887/E/main.cpp b/contests/Round887/E/main.cpp new file mode 100755 index 0000000..20800e5 --- /dev/null +++ b/contests/Round887/E/main.cpp @@ -0,0 +1,129 @@ +#include +using namespace std; + +using ll = long long; +using pii = pair; +using vpi = vector; +using vi = vector; +using vll = vector; +using mpii = map; +using mpll = map; +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 +#define make_unique(x) \ + sort(all((x))); \ + (x).resize(unique(all((x))) - (x).begin()) +#define ceil(a, b) ((a) + (b) - 1) / (b)) + +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}; + +template +ostream &operator<<(ostream &os, const pair &p); +template ostream &operator<<(ostream &os, const vector &vec); +template +ostream &operator<<(ostream &os, const map &m); +template +ostream &operator<<(ostream &os, const unordered_map &m); +template ostream &operator<<(ostream &os, const set &s); +template +ostream &operator<<(ostream &os, const unordered_set &s); + +template +ostream &operator<<(ostream &os, const pair &p) { + os << "(" << p.first << ", " << p.second << ")"; + return os; +} + +template ostream &operator<<(ostream &os, const vector &vec) { + os << "{"; + for (size_t i = 0; i < vec.size(); ++i) { + if (i > 0) + os << ", "; + os << vec[i]; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const map &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const unordered_map &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template ostream &operator<<(ostream &os, const set &s) { + int i = 0; + os << "{"; + for (const auto &e : s) { + if (i > 0) + os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const unordered_set &s) { + int i = 0; + os << "{"; + for (const auto &e : s) { + if (i > 0) + os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +void dbg() { cerr << "\n"; } + +template void dbg(T val, TS... vals) { + cerr << val << " "; + dbg(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 main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while (tt--) { + solve(); + } +} diff --git a/contests/Round887/F/main.cpp b/contests/Round887/F/main.cpp new file mode 100755 index 0000000..20800e5 --- /dev/null +++ b/contests/Round887/F/main.cpp @@ -0,0 +1,129 @@ +#include +using namespace std; + +using ll = long long; +using pii = pair; +using vpi = vector; +using vi = vector; +using vll = vector; +using mpii = map; +using mpll = map; +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 +#define make_unique(x) \ + sort(all((x))); \ + (x).resize(unique(all((x))) - (x).begin()) +#define ceil(a, b) ((a) + (b) - 1) / (b)) + +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}; + +template +ostream &operator<<(ostream &os, const pair &p); +template ostream &operator<<(ostream &os, const vector &vec); +template +ostream &operator<<(ostream &os, const map &m); +template +ostream &operator<<(ostream &os, const unordered_map &m); +template ostream &operator<<(ostream &os, const set &s); +template +ostream &operator<<(ostream &os, const unordered_set &s); + +template +ostream &operator<<(ostream &os, const pair &p) { + os << "(" << p.first << ", " << p.second << ")"; + return os; +} + +template ostream &operator<<(ostream &os, const vector &vec) { + os << "{"; + for (size_t i = 0; i < vec.size(); ++i) { + if (i > 0) + os << ", "; + os << vec[i]; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const map &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const unordered_map &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template ostream &operator<<(ostream &os, const set &s) { + int i = 0; + os << "{"; + for (const auto &e : s) { + if (i > 0) + os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +template +ostream &operator<<(ostream &os, const unordered_set &s) { + int i = 0; + os << "{"; + for (const auto &e : s) { + if (i > 0) + os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +void dbg() { cerr << "\n"; } + +template void dbg(T val, TS... vals) { + cerr << val << " "; + dbg(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 main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while (tt--) { + solve(); + } +} -- cgit v1.2.3