diff options
Diffstat (limited to 'codeforces')
55 files changed, 1800 insertions, 108 deletions
diff --git a/codeforces/BearAndBigBrother/main b/codeforces/BearAndBigBrother/main Binary files differnew file mode 100755 index 0000000..0098166 --- /dev/null +++ b/codeforces/BearAndBigBrother/main diff --git a/codeforces/BearAndBigBrother/main.cpp b/codeforces/BearAndBigBrother/main.cpp new file mode 100755 index 0000000..d4e9c1f --- /dev/null +++ b/codeforces/BearAndBigBrother/main.cpp @@ -0,0 +1,136 @@ +#include<bits/stdc++.h> +using namespace std; + +using ll = long long; +using pii = pair<int, int>; +using vpi = vector<pii>; +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 +#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<typename K, typename V> ostream& operator<<(ostream& os, const pair<K, V>& p); +template<typename T> ostream& operator<<(ostream& os, const vector<T>& vec); +template<typename K, typename V> ostream& operator<<(ostream& os, const map<K, V>& m); +template<typename K, typename V> ostream& operator<<(ostream& os, const unordered_map<K, V>& m); +template<typename T> ostream& operator<<(ostream& os, const set<T>& s); +template<typename T> ostream& operator<<(ostream& os, const unordered_set<T>& s); + +template<typename K, typename V> +ostream& operator<<(ostream& os, const pair<K, V>& p) { + os << "(" << p.first << ", " << p.second << ")"; + return os; +} + +template<typename T> +ostream& operator<<(ostream& os, const vector<T>& vec) { + os << "{"; + for (size_t i = 0; i < vec.size(); ++i) { + if (i > 0) os << ", "; + os << vec[i]; + } + os << "}"; + return os; +} + + +template<typename K, typename V> +ostream& operator<<(ostream& os, const map<K, V>& m) { + os << "{"; + for (const auto& p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template<typename K, typename V> +ostream& operator<<(ostream& os, const unordered_map<K, V>& m) { + os << "{"; + for (const auto& p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template<typename T> +ostream& operator<<(ostream& os, const set<T>& s) { + int i = 0; + os << "{"; + for (const auto& e : s) { + if (i > 0) os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +template<typename T> +ostream& operator<<(ostream& os, const unordered_set<T>& s) { + int i = 0; + os << "{"; + for (const auto& e : s) { + if (i > 0) os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +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 a, b; + cin >> a >> b; + int ans = 0; + while (a <= b) { + a *= 3; + b *= 2; + ans++; + } + cout << ans << '\n'; +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + solve(); +} + + diff --git a/codeforces/BearAndBigBrother/main_input0.txt b/codeforces/BearAndBigBrother/main_input0.txt new file mode 100644 index 0000000..9ac1165 --- /dev/null +++ b/codeforces/BearAndBigBrother/main_input0.txt @@ -0,0 +1 @@ +4 7 diff --git a/codeforces/BearAndBigBrother/main_input1.txt b/codeforces/BearAndBigBrother/main_input1.txt new file mode 100644 index 0000000..aaf5572 --- /dev/null +++ b/codeforces/BearAndBigBrother/main_input1.txt @@ -0,0 +1 @@ +4 9 diff --git a/codeforces/BearAndBigBrother/main_input2.txt b/codeforces/BearAndBigBrother/main_input2.txt new file mode 100644 index 0000000..2fb73a0 --- /dev/null +++ b/codeforces/BearAndBigBrother/main_input2.txt @@ -0,0 +1 @@ +1 1 diff --git a/codeforces/BearAndBigBrother/main_output0.txt b/codeforces/BearAndBigBrother/main_output0.txt new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/codeforces/BearAndBigBrother/main_output0.txt @@ -0,0 +1 @@ +2 diff --git a/codeforces/BearAndBigBrother/main_output1.txt b/codeforces/BearAndBigBrother/main_output1.txt new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/codeforces/BearAndBigBrother/main_output1.txt @@ -0,0 +1 @@ +3 diff --git a/codeforces/BearAndBigBrother/main_output2.txt b/codeforces/BearAndBigBrother/main_output2.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/codeforces/BearAndBigBrother/main_output2.txt @@ -0,0 +1 @@ +1 diff --git a/codeforces/BlankSpace/main b/codeforces/BlankSpace/main Binary files differnew file mode 100755 index 0000000..4d5ec29 --- /dev/null +++ b/codeforces/BlankSpace/main diff --git a/codeforces/BlankSpace/main.cpp b/codeforces/BlankSpace/main.cpp new file mode 100755 index 0000000..cfbe4e3 --- /dev/null +++ b/codeforces/BlankSpace/main.cpp @@ -0,0 +1,147 @@ +#include <bits/stdc++.h> +using namespace std; + +using ll = long long; +using pii = pair<int, int>; +using vpi = vector<pii>; +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 +#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 <typename K, typename V> +ostream &operator<<(ostream &os, const pair<K, V> &p); +template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec); +template <typename K, typename V> +ostream &operator<<(ostream &os, const map<K, V> &m); +template <typename K, typename V> +ostream &operator<<(ostream &os, const unordered_map<K, V> &m); +template <typename T> ostream &operator<<(ostream &os, const set<T> &s); +template <typename T> +ostream &operator<<(ostream &os, const unordered_set<T> &s); + +template <typename K, typename V> +ostream &operator<<(ostream &os, const pair<K, V> &p) { + os << "(" << p.first << ", " << p.second << ")"; + return os; +} + +template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) { + os << "{"; + for (size_t i = 0; i < vec.size(); ++i) { + if (i > 0) + os << ", "; + os << vec[i]; + } + os << "}"; + return os; +} + +template <typename K, typename V> +ostream &operator<<(ostream &os, const map<K, V> &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template <typename K, typename V> +ostream &operator<<(ostream &os, const unordered_map<K, V> &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template <typename T> ostream &operator<<(ostream &os, const set<T> &s) { + int i = 0; + os << "{"; + for (const auto &e : s) { + if (i > 0) + os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +template <typename T> +ostream &operator<<(ostream &os, const unordered_set<T> &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 <typename T, typename... TS> 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; + int ans = 0; + for (int i = 0; i < n; i++) { + if (v[i] == 0) { + int cnt = 0; + while (v[i] == 0 && i < n) { + cnt++; + i++; + } + ans = max(ans, cnt); + } + } + cout << ans << '\n'; +} + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while (tt--) { + solve(); + } +} diff --git a/codeforces/BlankSpace/main_input0.txt b/codeforces/BlankSpace/main_input0.txt new file mode 100644 index 0000000..6eaba88 --- /dev/null +++ b/codeforces/BlankSpace/main_input0.txt @@ -0,0 +1,11 @@ +5 +5 +1 0 0 1 0 +4 +0 1 1 1 +1 +0 +3 +1 1 1 +9 +1 0 0 0 1 0 0 0 1 diff --git a/codeforces/BlankSpace/main_output0.txt b/codeforces/BlankSpace/main_output0.txt new file mode 100644 index 0000000..1d18ba1 --- /dev/null +++ b/codeforces/BlankSpace/main_output0.txt @@ -0,0 +1,5 @@ +2 +1 +1 +0 +3 diff --git a/codeforces/GameWithBoard/main b/codeforces/GameWithBoard/main Binary files differnew file mode 100755 index 0000000..20d57ba --- /dev/null +++ b/codeforces/GameWithBoard/main diff --git a/codeforces/GameWithBoard/main.cpp b/codeforces/GameWithBoard/main.cpp new file mode 100755 index 0000000..f9df6d0 --- /dev/null +++ b/codeforces/GameWithBoard/main.cpp @@ -0,0 +1,137 @@ +#include <bits/stdc++.h> +using namespace std; + +using ll = long long; +using pii = pair<int, int>; +using vpi = vector<pii>; +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 +#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 <typename K, typename V> +ostream &operator<<(ostream &os, const pair<K, V> &p); +template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec); +template <typename K, typename V> +ostream &operator<<(ostream &os, const map<K, V> &m); +template <typename K, typename V> +ostream &operator<<(ostream &os, const unordered_map<K, V> &m); +template <typename T> ostream &operator<<(ostream &os, const set<T> &s); +template <typename T> +ostream &operator<<(ostream &os, const unordered_set<T> &s); + +template <typename K, typename V> +ostream &operator<<(ostream &os, const pair<K, V> &p) { + os << "(" << p.first << ", " << p.second << ")"; + return os; +} + +template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) { + os << "{"; + for (size_t i = 0; i < vec.size(); ++i) { + if (i > 0) + os << ", "; + os << vec[i]; + } + os << "}"; + return os; +} + +template <typename K, typename V> +ostream &operator<<(ostream &os, const map<K, V> &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template <typename K, typename V> +ostream &operator<<(ostream &os, const unordered_map<K, V> &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template <typename T> ostream &operator<<(ostream &os, const set<T> &s) { + int i = 0; + os << "{"; + for (const auto &e : s) { + if (i > 0) + os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +template <typename T> +ostream &operator<<(ostream &os, const unordered_set<T> &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 <typename T, typename... TS> 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; + if (n <= 4) { + cout << "Bob\n"; + } else { + cout << "Alice\n"; + } +} + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while (tt--) { + solve(); + } +} diff --git a/codeforces/GameWithBoard/main_input0.txt b/codeforces/GameWithBoard/main_input0.txt new file mode 100644 index 0000000..a178d04 --- /dev/null +++ b/codeforces/GameWithBoard/main_input0.txt @@ -0,0 +1,3 @@ +2 +3 +6 diff --git a/codeforces/GameWithBoard/main_output0.txt b/codeforces/GameWithBoard/main_output0.txt new file mode 100644 index 0000000..45531b2 --- /dev/null +++ b/codeforces/GameWithBoard/main_output0.txt @@ -0,0 +1,2 @@ +Bob +Alice diff --git a/codeforces/GoldRush/main b/codeforces/GoldRush/main Binary files differnew file mode 100755 index 0000000..dbaf809 --- /dev/null +++ b/codeforces/GoldRush/main diff --git a/codeforces/GoldRush/main.cpp b/codeforces/GoldRush/main.cpp new file mode 100755 index 0000000..a6de3d9 --- /dev/null +++ b/codeforces/GoldRush/main.cpp @@ -0,0 +1,139 @@ +#include <bits/stdc++.h> +using namespace std; + +using ll = long long; +using pii = pair<int, int>; +using vpi = vector<pii>; +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 +#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 <typename K, typename V> +ostream &operator<<(ostream &os, const pair<K, V> &p); +template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec); +template <typename K, typename V> +ostream &operator<<(ostream &os, const map<K, V> &m); +template <typename K, typename V> +ostream &operator<<(ostream &os, const unordered_map<K, V> &m); +template <typename T> ostream &operator<<(ostream &os, const set<T> &s); +template <typename T> +ostream &operator<<(ostream &os, const unordered_set<T> &s); + +template <typename K, typename V> +ostream &operator<<(ostream &os, const pair<K, V> &p) { + os << "(" << p.first << ", " << p.second << ")"; + return os; +} + +template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) { + os << "{"; + for (size_t i = 0; i < vec.size(); ++i) { + if (i > 0) + os << ", "; + os << vec[i]; + } + os << "}"; + return os; +} + +template <typename K, typename V> +ostream &operator<<(ostream &os, const map<K, V> &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template <typename K, typename V> +ostream &operator<<(ostream &os, const unordered_map<K, V> &m) { + os << "{"; + for (const auto &p : m) { + os << p.first << ": " << p.second << ", "; + } + os << "}"; + return os; +} + +template <typename T> ostream &operator<<(ostream &os, const set<T> &s) { + int i = 0; + os << "{"; + for (const auto &e : s) { + if (i > 0) + os << ", "; + os << e; + i++; + } + os << "}"; + return os; +} + +template <typename T> +ostream &operator<<(ostream &os, const unordered_set<T> &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 <typename T, typename... TS> 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, s; + cin >> n >> s; + if (n > s && n % 3 == 0) { + while (n != 1) { + } + cout << "YES\n"; + } else { + cout << "NO\n"; + } +} + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while (tt--) { + solve(); + } +} diff --git a/codeforces/GoldRush/main_input0.txt b/codeforces/GoldRush/main_input0.txt new file mode 100644 index 0000000..61f3631 --- /dev/null +++ b/codeforces/GoldRush/main_input0.txt @@ -0,0 +1,12 @@ +11 +6 4 +9 4 +4 2 +18 27 +27 4 +27 2 +27 10 +1 1 +3 1 +5 1 +746001 2984004 diff --git a/codeforces/GoldRush/main_output0.txt b/codeforces/GoldRush/main_output0.txt new file mode 100644 index 0000000..d99d5ba --- /dev/null +++ b/codeforces/GoldRush/main_output0.txt @@ -0,0 +1,11 @@ +YES +YES +NO +NO +YES +YES +NO +YES +YES +NO +NO diff --git a/codeforces/InsertDigit/main b/codeforces/InsertDigit/main Binary files differnew file mode 100755 index 0000000..0e3aff8 --- /dev/null +++ b/codeforces/InsertDigit/main diff --git a/codeforces/InsertDigit/main.cpp b/codeforces/InsertDigit/main.cpp new file mode 100755 index 0000000..43270a6 --- /dev/null +++ b/codeforces/InsertDigit/main.cpp @@ -0,0 +1,148 @@ +#include<bits/stdc++.h> +using namespace std; + +using ll = long long; +using pii = pair<int, int>; +using vpi = vector<pii>; +using vi = vector<int>;< |
