From 41e4a123e8a63a0a33bc7c89569731c2daf65d95 Mon Sep 17 00:00:00 2001 From: omagdy7 Date: Sat, 25 Mar 2023 15:43:13 +0200 Subject: Solve some problems --- contests/EduRound145/A/main | Bin 0 -> 55032 bytes contests/EduRound145/A/main.cpp | 152 +++++++++++++++++++++++++++++++ contests/EduRound145/A/main_input0.txt | 4 + contests/EduRound145/A/main_output0.txt | 3 + contests/EduRound145/B/main | Bin 0 -> 17984 bytes contests/EduRound145/B/main.cpp | 150 +++++++++++++++++++++++++++++++ contests/EduRound145/B/main_input0.txt | 5 ++ contests/EduRound145/B/main_input1.txt | 2 + contests/EduRound145/B/main_input2.txt | 4 + contests/EduRound145/B/main_input3.txt | 6 ++ contests/EduRound145/B/main_input4.txt | 2 + contests/EduRound145/B/main_output0.txt | 4 + contests/EduRound145/B/main_output1.txt | 1 + contests/EduRound145/B/main_output2.txt | 3 + contests/EduRound145/B/main_output3.txt | 5 ++ contests/EduRound145/B/main_output4.txt | 1 + contests/EduRound145/C/main.cpp | 136 ++++++++++++++++++++++++++++ contests/EduRound145/D/main.cpp | 132 +++++++++++++++++++++++++++ contests/EduRound145/E/main.cpp | 132 +++++++++++++++++++++++++++ contests/EduRound145/F/main.cpp | 132 +++++++++++++++++++++++++++ contests/Starters82/A/main | Bin 0 -> 17584 bytes contests/Starters82/A/main.cpp | 139 ++++++++++++++++++++++++++++ contests/Starters82/A/main_input0.txt | 5 ++ contests/Starters82/A/main_output0.txt | 4 + contests/Starters82/B/main | Bin 0 -> 23160 bytes contests/Starters82/B/main.cpp | 141 +++++++++++++++++++++++++++++ contests/Starters82/B/main_input0.txt | 7 ++ contests/Starters82/B/main_output0.txt | 3 + contests/Starters82/C/main | Bin 0 -> 28232 bytes contests/Starters82/C/main.cpp | 154 ++++++++++++++++++++++++++++++++ contests/Starters82/C/main_input0.txt | 10 +++ contests/Starters82/C/main_input1.txt | 4 + contests/Starters82/C/main_input2.txt | 4 + contests/Starters82/C/main_input3.txt | 4 + contests/Starters82/C/main_input4.txt | 4 + contests/Starters82/C/main_input5.txt | 4 + contests/Starters82/C/main_input6.txt | 4 + contests/Starters82/C/main_input7.txt | 4 + contests/Starters82/C/main_output0.txt | 3 + contests/Starters82/C/main_output1.txt | 1 + contests/Starters82/C/main_output2.txt | 1 + contests/Starters82/C/main_output3.txt | 1 + contests/Starters82/C/main_output4.txt | 1 + contests/Starters82/C/main_output5.txt | 1 + contests/Starters82/C/main_output6.txt | 1 + contests/Starters82/C/main_output7.txt | 1 + contests/Starters82/D/main | Bin 0 -> 22160 bytes contests/Starters82/D/main.cpp | 152 +++++++++++++++++++++++++++++++ contests/Starters82/D/main_input0.txt | 2 + contests/Starters82/D/main_output0.txt | 4 + contests/Starters82/E/main | Bin 0 -> 17872 bytes contests/Starters82/E/main.cpp | 143 +++++++++++++++++++++++++++++ contests/Starters82/E/main_input0.txt | 4 + contests/Starters82/E/main_output0.txt | 3 + contests/Starters82/F/main.cpp | 132 +++++++++++++++++++++++++++ 55 files changed, 1815 insertions(+) create mode 100755 contests/EduRound145/A/main create mode 100755 contests/EduRound145/A/main.cpp create mode 100644 contests/EduRound145/A/main_input0.txt create mode 100644 contests/EduRound145/A/main_output0.txt create mode 100755 contests/EduRound145/B/main create mode 100755 contests/EduRound145/B/main.cpp create mode 100644 contests/EduRound145/B/main_input0.txt create mode 100644 contests/EduRound145/B/main_input1.txt create mode 100644 contests/EduRound145/B/main_input2.txt create mode 100644 contests/EduRound145/B/main_input3.txt create mode 100644 contests/EduRound145/B/main_input4.txt create mode 100644 contests/EduRound145/B/main_output0.txt create mode 100644 contests/EduRound145/B/main_output1.txt create mode 100644 contests/EduRound145/B/main_output2.txt create mode 100644 contests/EduRound145/B/main_output3.txt create mode 100644 contests/EduRound145/B/main_output4.txt create mode 100755 contests/EduRound145/C/main.cpp create mode 100755 contests/EduRound145/D/main.cpp create mode 100755 contests/EduRound145/E/main.cpp create mode 100755 contests/EduRound145/F/main.cpp create mode 100755 contests/Starters82/A/main create mode 100755 contests/Starters82/A/main.cpp create mode 100644 contests/Starters82/A/main_input0.txt create mode 100644 contests/Starters82/A/main_output0.txt create mode 100755 contests/Starters82/B/main create mode 100755 contests/Starters82/B/main.cpp create mode 100644 contests/Starters82/B/main_input0.txt create mode 100644 contests/Starters82/B/main_output0.txt create mode 100755 contests/Starters82/C/main create mode 100755 contests/Starters82/C/main.cpp create mode 100644 contests/Starters82/C/main_input0.txt create mode 100644 contests/Starters82/C/main_input1.txt create mode 100644 contests/Starters82/C/main_input2.txt create mode 100644 contests/Starters82/C/main_input3.txt create mode 100644 contests/Starters82/C/main_input4.txt create mode 100644 contests/Starters82/C/main_input5.txt create mode 100644 contests/Starters82/C/main_input6.txt create mode 100644 contests/Starters82/C/main_input7.txt create mode 100644 contests/Starters82/C/main_output0.txt create mode 100644 contests/Starters82/C/main_output1.txt create mode 100644 contests/Starters82/C/main_output2.txt create mode 100644 contests/Starters82/C/main_output3.txt create mode 100644 contests/Starters82/C/main_output4.txt create mode 100644 contests/Starters82/C/main_output5.txt create mode 100644 contests/Starters82/C/main_output6.txt create mode 100644 contests/Starters82/C/main_output7.txt create mode 100755 contests/Starters82/D/main create mode 100755 contests/Starters82/D/main.cpp create mode 100644 contests/Starters82/D/main_input0.txt create mode 100644 contests/Starters82/D/main_output0.txt create mode 100755 contests/Starters82/E/main create mode 100755 contests/Starters82/E/main.cpp create mode 100644 contests/Starters82/E/main_input0.txt create mode 100644 contests/Starters82/E/main_output0.txt create mode 100755 contests/Starters82/F/main.cpp (limited to 'contests') diff --git a/contests/EduRound145/A/main b/contests/EduRound145/A/main new file mode 100755 index 0000000..d1d325c Binary files /dev/null and b/contests/EduRound145/A/main differ diff --git a/contests/EduRound145/A/main.cpp b/contests/EduRound145/A/main.cpp new file mode 100755 index 0000000..171d87c --- /dev/null +++ b/contests/EduRound145/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 print() { + cerr << "\n"; +} + +template +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() { + string s; + cin >> s; + set st; + map mp; + for (auto ch : s) { + st.insert(ch); + mp[ch]++; + } + for (auto ch : st) { + if (mp[ch] == 3) { + cout << 6 << '\n'; + return; + } else if (mp[ch] == 4) { + cout << -1 << '\n'; + return; + } + } + cout << 4 << '\n'; + + + +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + solve(); + } +} + + diff --git a/contests/EduRound145/A/main_input0.txt b/contests/EduRound145/A/main_input0.txt new file mode 100644 index 0000000..4fa6caf --- /dev/null +++ b/contests/EduRound145/A/main_input0.txt @@ -0,0 +1,4 @@ +3 +9546 +0000 +3313 diff --git a/contests/EduRound145/A/main_output0.txt b/contests/EduRound145/A/main_output0.txt new file mode 100644 index 0000000..5aa0822 --- /dev/null +++ b/contests/EduRound145/A/main_output0.txt @@ -0,0 +1,3 @@ +4 +-1 +6 diff --git a/contests/EduRound145/B/main b/contests/EduRound145/B/main new file mode 100755 index 0000000..2b608e5 Binary files /dev/null and b/contests/EduRound145/B/main differ diff --git a/contests/EduRound145/B/main.cpp b/contests/EduRound145/B/main.cpp new file mode 100755 index 0000000..f95b893 --- /dev/null +++ b/contests/EduRound145/B/main.cpp @@ -0,0 +1,150 @@ +#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 print() { + cerr << "\n"; +} + +template +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 + */ + +ll mySqrt(ll a) { + ll l = 0, r = 1e9 + 1; + while (l + 1 < r) { + ll m = (l + r) / 2; + if (m * m <= a) { + l = m; + } else { + r = m; + } + } + return l; +} + +void solve() { + ll n; + cin >> n; + cout << (ll)sqrt(n - 1) << '\n'; +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + solve(); + } +} + + diff --git a/contests/EduRound145/B/main_input0.txt b/contests/EduRound145/B/main_input0.txt new file mode 100644 index 0000000..e383f1f --- /dev/null +++ b/contests/EduRound145/B/main_input0.txt @@ -0,0 +1,5 @@ +4 +1 +3 +5 +975461057789971042 diff --git a/contests/EduRound145/B/main_input1.txt b/contests/EduRound145/B/main_input1.txt new file mode 100644 index 0000000..42a2f8b --- /dev/null +++ b/contests/EduRound145/B/main_input1.txt @@ -0,0 +1,2 @@ +1 +6 \ No newline at end of file diff --git a/contests/EduRound145/B/main_input2.txt b/contests/EduRound145/B/main_input2.txt new file mode 100644 index 0000000..051f23d --- /dev/null +++ b/contests/EduRound145/B/main_input2.txt @@ -0,0 +1,4 @@ +3 +2 +4 +16 \ No newline at end of file diff --git a/contests/EduRound145/B/main_input3.txt b/contests/EduRound145/B/main_input3.txt new file mode 100644 index 0000000..ee95794 --- /dev/null +++ b/contests/EduRound145/B/main_input3.txt @@ -0,0 +1,6 @@ +5 +9 +10 +12 +15 +16 \ No newline at end of file diff --git a/contests/EduRound145/B/main_input4.txt b/contests/EduRound145/B/main_input4.txt new file mode 100644 index 0000000..ccb572c --- /dev/null +++ b/contests/EduRound145/B/main_input4.txt @@ -0,0 +1,2 @@ +1 +1000000000000000000 \ No newline at end of file diff --git a/contests/EduRound145/B/main_output0.txt b/contests/EduRound145/B/main_output0.txt new file mode 100644 index 0000000..00eb37d --- /dev/null +++ b/contests/EduRound145/B/main_output0.txt @@ -0,0 +1,4 @@ +0 +1 +2 +987654321 diff --git a/contests/EduRound145/B/main_output1.txt b/contests/EduRound145/B/main_output1.txt new file mode 100644 index 0000000..d8263ee --- /dev/null +++ b/contests/EduRound145/B/main_output1.txt @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/contests/EduRound145/B/main_output2.txt b/contests/EduRound145/B/main_output2.txt new file mode 100644 index 0000000..da8092b --- /dev/null +++ b/contests/EduRound145/B/main_output2.txt @@ -0,0 +1,3 @@ +1 +2 +4 \ No newline at end of file diff --git a/contests/EduRound145/B/main_output3.txt b/contests/EduRound145/B/main_output3.txt new file mode 100644 index 0000000..d78555d --- /dev/null +++ b/contests/EduRound145/B/main_output3.txt @@ -0,0 +1,5 @@ +3 +3 +3 +3 +4 \ No newline at end of file diff --git a/contests/EduRound145/B/main_output4.txt b/contests/EduRound145/B/main_output4.txt new file mode 100644 index 0000000..21ce28a --- /dev/null +++ b/contests/EduRound145/B/main_output4.txt @@ -0,0 +1 @@ +1000000000 \ No newline at end of file diff --git a/contests/EduRound145/C/main.cpp b/contests/EduRound145/C/main.cpp new file mode 100755 index 0000000..8cfbed2 --- /dev/null +++ b/contests/EduRound145/C/main.cpp @@ -0,0 +1,136 @@ +#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 print() { + cerr << "\n"; +} + +template +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, k; + cin >> n >> k; + vi a = {1, 2, -3, 4, 5}; + + +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + solve(); + } +} + + diff --git a/contests/EduRound145/D/main.cpp b/contests/EduRound145/D/main.cpp new file mode 100755 index 0000000..70c7757 --- /dev/null +++ b/contests/EduRound145/D/main.cpp @@ -0,0 +1,132 @@ +#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 print() { + cerr << "\n"; +} + +template +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 main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + solve(); + } +} + + diff --git a/contests/EduRound145/E/main.cpp b/contests/EduRound145/E/main.cpp new file mode 100755 index 0000000..70c7757 --- /dev/null +++ b/contests/EduRound145/E/main.cpp @@ -0,0 +1,132 @@ +#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 print() { + cerr << "\n"; +} + +template +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 main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + solve(); + } +} + + diff --git a/contests/EduRound145/F/main.cpp b/contests/EduRound145/F/main.cpp new file mode 100755 index 0000000..70c7757 --- /dev/null +++ b/contests/EduRound145/F/main.cpp @@ -0,0 +1,132 @@ +#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 print() { + cerr << "\n"; +} + +template +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 main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + solve(); + } +} + + diff --git a/contests/Starters82/A/main b/contests/Starters82/A/main new file mode 100755 index 0000000..d083489 Binary files /dev/null and b/contests/Starters82/A/main differ diff --git a/contests/Starters82/A/main.cpp b/contests/Starters82/A/main.cpp new file mode 100755 index 0000000..3cf63d2 --- /dev/null +++ b/contests/Starters82/A/main.cpp @@ -0,0 +1,139 @@ +#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 print() { + cerr << "\n"; +} + +template +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 x, y; + cin >> x >> y; + if (x * 5 >= y) { + 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/contests/Starters82/A/main_input0.txt b/contests/Starters82/A/main_input0.txt new file mode 100644 index 0000000..4fe6060 --- /dev/null +++ b/contests/Starters82/A/main_input0.txt @@ -0,0 +1,5 @@ +4 +2 10 +3 17 +4 2 +6 45 diff --git a/contests/Starters82/A/main_output0.txt b/contests/Starters82/A/main_output0.txt new file mode 100644 index 0000000..2bc7799 --- /dev/null +++ b/contests/Starters82/A/main_output0.txt @@ -0,0 +1,4 @@ +YES +NO +YES +NO diff --git a/contests/Starters82/B/main b/contests/Starters82/B/main new file mode 100755 index 0000000..d9491a3 Binary files /dev/null and b/contests/Starters82/B/main differ diff --git a/contests/Starters82/B/main.cpp b/contests/Starters82/B/main.cpp new file mode 100755 index 0000000..7e23050 --- /dev/null +++ b/contests/Starters82/B/main.cpp @@ -0,0 +1,141 @@ +#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 print() { + cerr << "\n"; +} + +template +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; + cin >> n; + vi v(n); + int mn = INT_MAX; + for (auto &x : v) { + cin >> x; + mn = min(mn, x); + } + cout << n - count(all(v), mn) << '\n'; + +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + solve(); + } +} + + diff --git a/contests/Starters82/B/main_input0.txt b/contests/Starters82/B/main_input0.txt new file mode 100644 index 0000000..2f90ee6 --- /dev/null +++ b/contests/Starters82/B/main_input0.txt @@ -0,0 +1,7 @@ +3 +2 +1 2 +4 +2 2 3 4 +1 +1 diff --git a/contests/Starters82/B/main_output0.txt b/contests/Starters82/B/main_output0.txt new file mode 100644 index 0000000..a384d6e --- /dev/null +++ b/contests/Starters82/B/main_output0.txt @@ -0,0 +1,3 @@ +1 +2 +0 diff --git a/contests/Starters82/C/main b/contests/Starters82/C/main new file mode 100755 index 0000000..618a825 Binary files /dev/null and b/contests/Starters82/C/main differ diff --git a/contests/Starters82/C/main.cpp b/contests/Starters82/C/main.cpp new file mode 100755 index 0000000..a956cf6 --- /dev/null +++ b/contests/Starters82/C/main.cpp @@ -0,0 +1,154 @@ +#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 print() { + cerr << "\n"; +} + +template +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; + cin >> n; + vi a(n); + vi b(n); + for (auto &x : a) cin >> x; + for (auto &x : b) cin >> x; + int ons = count(all(a), 1); + if (a == b) { + cout << "YES\n"; + return; + } + for (int i = 0; i < n; i++) { + if (a[i] == 1 && b[i] == 0) { + cout << "NO\n"; + return; + } else if (a[i] == 0 && b[i] == 1) { + if (ons == 0 || i == 0) { + cout << "NO\n"; + return; + } + } + } + cout << "YES\n"; +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + solve(); + } +} + + diff --git a/contests/Starters82/C/main_input0.txt b/contests/Starters82/C/main_input0.txt new file mode 100644 index 0000000..f303c19 --- /dev/null +++ b/contests/Starters82/C/main_input0.txt @@ -0,0 +1,10 @@ +3 +5 +0 1 0 0 1 +0 1 1 1 1 +3 +1 0 0 +0 0 1 +3 +0 0 0 +0 1 0 diff --git a/contests/Starters82/C/main_input1.txt b/contests/Starters82/C/main_input1.txt new file mode 100644 index 0000000..c89d8f6 --- /dev/null +++ b/contests/Starters82/C/main_input1.txt @@ -0,0 +1,4 @@ +1 +5 +1 0 1 0 1 +0 0 1 0 1 \ No newline at end of file diff --git a/contests/Starters82/C/main_input2.txt b/contests/Starters82/C/main_input2.txt new file mode 100644 index 0000000..2fc17c5 --- /dev/null +++ b/contests/Starters82/C/main_input2.txt @@ -0,0 +1,4 @@ +1 +5 +1 0 0 0 0 +0 1 1 1 0 \ No newline at end of file diff --git a/contests/Starters82/C/main_input3.txt b/contests/Starters82/C/main_input3.txt new file mode 100644 index 0000000..8f22c40 --- /dev/null +++ b/contests/Starters82/C/main_input3.txt @@ -0,0 +1,4 @@ +1 +5 +1 0 0 0 0 +1 1 1 1 1 \ No newline at end of file diff --git a/contests/Starters82/C/main_input4.txt b/contests/Starters82/C/main_input4.txt new file mode 100644 index 0000000..2e551cc --- /dev/null +++ b/contests/Starters82/C/main_input4.txt @@ -0,0 +1,4 @@ +1 +3 +1 0 0 +1 1 1 \ No newline at end of file diff --git a/contests/Starters82/C/main_input5.txt b/contests/Starters82/C/main_input5.txt new file mode 100644 index 0000000..73b69ca --- /dev/null +++ b/contests/Starters82/C/main_input5.txt @@ -0,0 +1,4 @@ +1 +3 +0 0 1 +0 1 1 \ No newline at end of file diff --git a/contests/Starters82/C/main_input6.txt b/contests/Starters82/C/main_input6.txt new file mode 100644 index 0000000..b129f6d --- /dev/null +++ b/contests/Starters82/C/main_input6.txt @@ -0,0 +1,4 @@ +1 +3 +0 1 1 +1 1 1 \ No newline at end of file diff --git a/contests/Starters82/C/main_input7.txt b/contests/Starters82/C/main_input7.txt new file mode 100644 index 0000000..853949c --- /dev/null +++ b/contests/Starters82/C/main_input7.txt @@ -0,0 +1,4 @@ +1 +6 +0 1 1 0 0 0 +0 1 1 1 1 0 \ No newline at end of file diff --git a/contests/Starters82/C/main_output0.txt b/contests/Starters82/C/main_output0.txt new file mode 100644 index 0000000..c6e03a3 --- /dev/null +++ b/contests/Starters82/C/main_output0.txt @@ -0,0 +1,3 @@ +YES +NO +NO diff --git a/contests/Starters82/C/main_output1.txt b/contests/Starters82/C/main_output1.txt new file mode 100644 index 0000000..ba28208 --- /dev/null +++ b/contests/Starters82/C/main_output1.txt @@ -0,0 +1 @@ +NO \ No newline at end of file diff --git a/contests/Starters82/C/main_output2.txt b/contests/Starters82/C/main_output2.txt new file mode 100644 index 0000000..d2bb323 --- /dev/null +++ b/contests/Starters82/C/main_output2.txt @@ -0,0 +1 @@ +YES \ No newline at end of file diff --git a/contests/Starters82/C/main_output3.txt b/contests/Starters82/C/main_output3.txt new file mode 100644 index 0000000..d2bb323 --- /dev/null +++ b/contests/Starters82/C/main_output3.txt @@ -0,0 +1 @@ +YES \ No newline at end of file diff --git a/contests/Starters82/C/main_output4.txt b/contests/Starters82/C/main_output4.txt new file mode 100644 index 0000000..d2bb323 --- /dev/null +++ b/contests/Starters82/C/main_output4.txt @@ -0,0 +1 @@ +YES \ No newline at end of file diff --git a/contests/Starters82/C/main_output5.txt b/contests/Starters82/C/main_output5.txt new file mode 100644 index 0000000..d2bb323 --- /dev/null +++ b/contests/Starters82/C/main_output5.txt @@ -0,0 +1 @@ +YES \ No newline at end of file diff --git a/contests/Starters82/C/main_output6.txt b/contests/Starters82/C/main_output6.txt new file mode 100644 index 0000000..ba28208 --- /dev/null +++ b/contests/Starters82/C/main_output6.txt @@ -0,0 +1 @@ +NO \ No newline at end of file diff --git a/contests/Starters82/C/main_output7.txt b/contests/Starters82/C/main_output7.txt new file mode 100644 index 0000000..d2bb323 --- /dev/null +++ b/contests/Starters82/C/main_output7.txt @@ -0,0 +1 @@ +YES \ No newline at end of file diff --git a/contests/Starters82/D/main b/contests/Starters82/D/main new file mode 100755 index 0000000..2c14bb4 Binary files /dev/null and b/contests/Starters82/D/main differ diff --git a/contests/Starters82/D/main.cpp b/contests/Starters82/D/main.cpp new file mode 100755 index 0000000..50a7587 --- /dev/null +++ b/contests/Starters82/D/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 print() { + cerr << "\n"; +} + +template +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; + cin >> n; + vi v; + for (int i = 1; i <= n * n; i++) { + if (i % 2 == 0) { + v.pb(i); + } + } + for (int i = 1; i <= n * n; i++) { + if (i % 2 != 0) { + v.pb(i); + } + } + int k = 0; + for (int i = 0; i < n; i++) { + for (int j = 0; j < n; j++) { + cout << v[k++] << ' '; + } + cout << '\n'; + } + +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + solve(); + } +} + + diff --git a/contests/Starters82/D/main_input0.txt b/contests/Starters82/D/main_input0.txt new file mode 100644 index 0000000..2f1b638 --- /dev/null +++ b/contests/Starters82/D/main_input0.txt @@ -0,0 +1,2 @@ +1 +4 diff --git a/contests/Starters82/D/main_output0.txt b/contests/Starters82/D/main_output0.txt new file mode 100644 index 0000000..4cbdad4 --- /dev/null +++ b/contests/Starters82/D/main_output0.txt @@ -0,0 +1,4 @@ +12 10 6 14 +3 8 4 1 +5 15 11 9 +2 7 13 16 diff --git a/contests/Starters82/E/main b/contests/Starters82/E/main new file mode 100755 index 0000000..16f9d5d Binary files /dev/null and b/contests/Starters82/E/main differ diff --git a/contests/Starters82/E/main.cpp b/contests/Starters82/E/main.cpp new file mode 100755 index 0000000..d502e3b --- /dev/null +++ b/contests/Starters82/E/main.cpp @@ -0,0 +1,143 @@ +#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 print() { + cerr << "\n"; +} + +template +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() { + ll a, b, c, d; + cin >> a >> b >> c >> d; + if (a == c) { + cout << 1 << '\n'; + } + else if (b == 1 || d == 1) { + cout << max(b, d) << '\n'; + } else { + cout << b + d << '\n'; + } + + +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + solve(); + } +} + + diff --git a/contests/Starters82/E/main_input0.txt b/contests/Starters82/E/main_input0.txt new file mode 100644 index 0000000..c2e01db --- /dev/null +++ b/contests/Starters82/E/main_input0.txt @@ -0,0 +1,4 @@ +3 +4 7 4 8 +5 1 8 2 +3 2 4 3 diff --git a/contests/Starters82/E/main_output0.txt b/contests/Starters82/E/main_output0.txt new file mode 100644 index 0000000..c728202 --- /dev/null +++ b/contests/Starters82/E/main_output0.txt @@ -0,0 +1,3 @@ +1 +2 +5 diff --git a/contests/Starters82/F/main.cpp b/contests/Starters82/F/main.cpp new file mode 100755 index 0000000..70c7757 --- /dev/null +++ b/contests/Starters82/F/main.cpp @@ -0,0 +1,132 @@ +#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 print() { + cerr << "\n"; +} + +template +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 main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + solve(); + } +} + + -- cgit v1.2.3