diff options
| -rwxr-xr-x | Ghanophobia/main | bin | 0 -> 24608 bytes | |||
| -rw-r--r-- | Ghanophobia/main.cpp | 36 | ||||
| -rw-r--r-- | Ghanophobia/main_input0.txt | 4 | ||||
| -rw-r--r-- | Ghanophobia/main_output0.txt | 3 | ||||
| -rwxr-xr-x | cses/IntroductoryProblems/BitStrings/main (renamed from cses/BitStrings/main) | bin | 22544 -> 22544 bytes | |||
| -rw-r--r-- | cses/IntroductoryProblems/BitStrings/main.cpp (renamed from cses/BitStrings/main.cpp) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/BitStrings/main_input0.txt (renamed from cses/BitStrings/main_input0.txt) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/BitStrings/main_output0.txt (renamed from cses/BitStrings/main_output0.txt) | 0 | ||||
| -rwxr-xr-x | cses/IntroductoryProblems/IncreasingArray/main (renamed from cses/IncreasingArray/main) | bin | 22592 -> 22592 bytes | |||
| -rw-r--r-- | cses/IntroductoryProblems/IncreasingArray/main.cpp (renamed from cses/IncreasingArray/main.cpp) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/IncreasingArray/main_input0.txt (renamed from cses/IncreasingArray/main_input0.txt) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/IncreasingArray/main_output0.txt (renamed from cses/IncreasingArray/main_output0.txt) | 0 | ||||
| -rwxr-xr-x | cses/IntroductoryProblems/MissingNumber/main (renamed from cses/MissingNumber/main) | bin | 22600 -> 22600 bytes | |||
| -rw-r--r-- | cses/IntroductoryProblems/MissingNumber/main.cpp (renamed from cses/MissingNumber/main.cpp) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/MissingNumber/main_input0.txt (renamed from cses/MissingNumber/main_input0.txt) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/MissingNumber/main_input1.txt (renamed from cses/MissingNumber/main_input1.txt) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/MissingNumber/main_output0.txt (renamed from cses/MissingNumber/main_output0.txt) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/MissingNumber/main_output1.txt (renamed from cses/MissingNumber/main_output1.txt) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/PalindromeReorder/main.cpp | 30 | ||||
| -rwxr-xr-x | cses/IntroductoryProblems/Permutations/main (renamed from cses/Permutations/main) | bin | 22544 -> 22544 bytes | |||
| -rw-r--r-- | cses/IntroductoryProblems/Permutations/main.cpp (renamed from cses/Permutations/main.cpp) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/Permutations/main_input0.txt (renamed from cses/Permutations/main_input0.txt) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/Permutations/main_input1.txt (renamed from cses/Permutations/main_input1.txt) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/Permutations/main_output0.txt (renamed from cses/Permutations/main_output0.txt) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/Permutations/main_output1.txt (renamed from cses/Permutations/main_output1.txt) | 0 | ||||
| -rwxr-xr-x | cses/IntroductoryProblems/Repetitions/main (renamed from cses/Repetitions/main) | bin | 23416 -> 23416 bytes | |||
| -rw-r--r-- | cses/IntroductoryProblems/Repetitions/main.cpp (renamed from cses/Repetitions/main.cpp) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/Repetitions/main_input0.txt (renamed from cses/Repetitions/main_input0.txt) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/Repetitions/main_output0.txt (renamed from cses/Repetitions/main_output0.txt) | 0 | ||||
| -rwxr-xr-x | cses/IntroductoryProblems/TrailingZeros/main (renamed from cses/TrailingZeros/main) | bin | 22544 -> 22544 bytes | |||
| -rw-r--r-- | cses/IntroductoryProblems/TrailingZeros/main.cpp (renamed from cses/TrailingZeros/main.cpp) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/TrailingZeros/main_input0.txt (renamed from cses/TrailingZeros/main_input0.txt) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/TrailingZeros/main_output0.txt (renamed from cses/TrailingZeros/main_output0.txt) | 0 | ||||
| -rwxr-xr-x | cses/IntroductoryProblems/TrailingZeros/test.py (renamed from cses/TrailingZeros/test.py) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/TrailingZeros/test.txt (renamed from cses/TrailingZeros/test.txt) | 0 | ||||
| -rwxr-xr-x | cses/IntroductoryProblems/TwoSets/main | bin | 0 -> 31984 bytes | |||
| -rw-r--r-- | cses/IntroductoryProblems/TwoSets/main.cpp | 41 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/TwoSets/main_input0.txt (renamed from cses/TwoSets/main_input0.txt) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/TwoSets/main_input1.txt (renamed from cses/TwoSets/main_input1.txt) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/TwoSets/main_output0.txt (renamed from cses/TwoSets/main_output0.txt) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/TwoSets/main_output1.txt (renamed from cses/TwoSets/main_output1.txt) | 0 | ||||
| -rwxr-xr-x | cses/IntroductoryProblems/WeirdAlgorithm/main (renamed from cses/WeirdAlgorithm/main) | bin | 22544 -> 22544 bytes | |||
| -rw-r--r-- | cses/IntroductoryProblems/WeirdAlgorithm/main.cpp (renamed from cses/WeirdAlgorithm/main.cpp) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/WeirdAlgorithm/main_input0.txt (renamed from cses/WeirdAlgorithm/main_input0.txt) | 0 | ||||
| -rw-r--r-- | cses/IntroductoryProblems/WeirdAlgorithm/main_output0.txt (renamed from cses/WeirdAlgorithm/main_output0.txt) | 0 | ||||
| -rw-r--r-- | cses/SortingAndSearching/DistinctNumbers/main.cpp | 16 | ||||
| -rwxr-xr-x | cses/TwoSets/main | bin | 49768 -> 0 bytes | |||
| -rw-r--r-- | cses/TwoSets/main.cpp | 46 | ||||
| -rwxr-xr-x | cubesShuffling/main | bin | 0 -> 44632 bytes | |||
| -rw-r--r-- | cubesShuffling/main.cpp | 41 | ||||
| -rw-r--r-- | cubesShuffling/main_input0.txt | 5 | ||||
| -rw-r--r-- | cubesShuffling/main_output0.txt | 4 |
52 files changed, 180 insertions, 46 deletions
diff --git a/Ghanophobia/main b/Ghanophobia/main Binary files differnew file mode 100755 index 0000000..80108cd --- /dev/null +++ b/Ghanophobia/main diff --git a/Ghanophobia/main.cpp b/Ghanophobia/main.cpp new file mode 100644 index 0000000..31dff88 --- /dev/null +++ b/Ghanophobia/main.cpp @@ -0,0 +1,36 @@ +#include<bits/stdc++.h> +#include <cstring> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + freopen("ghanophobia.in", "r", stdin); + int tt; + cin >> tt; + int cnt = 0; + while(tt--){ + cnt++; + string s; + cin >> s; + string s1 = s.substr(0, s.find(":")); + string s2 = s.substr(s.find(":") + 1, s.length() - 1); + int eg = stoi(s1) + 1; + int gh = stoi(s2) + 6; + cout << "Case " << cnt << ": "; + if (eg == gh){ + if (gh - 6 > 1) { + cout << "NO\n"; + } else if (gh - 6 == 1) { + cout << "PENALTIES\n"; + } else { + cout << "YES\n"; + } + } else if(eg > gh) { + cout << "YES\n"; + } else { + cout << "NO\n"; + } + } +} diff --git a/Ghanophobia/main_input0.txt b/Ghanophobia/main_input0.txt new file mode 100644 index 0000000..ae9045c --- /dev/null +++ b/Ghanophobia/main_input0.txt @@ -0,0 +1,4 @@ +3 +6:0 +1:1 +6:1 diff --git a/Ghanophobia/main_output0.txt b/Ghanophobia/main_output0.txt new file mode 100644 index 0000000..b0ad2a2 --- /dev/null +++ b/Ghanophobia/main_output0.txt @@ -0,0 +1,3 @@ +Case 1: YES +Case 2: NO +Case 3: PENALTIES diff --git a/cses/BitStrings/main b/cses/IntroductoryProblems/BitStrings/main Binary files differindex 177fec4..177fec4 100755 --- a/cses/BitStrings/main +++ b/cses/IntroductoryProblems/BitStrings/main diff --git a/cses/BitStrings/main.cpp b/cses/IntroductoryProblems/BitStrings/main.cpp index db812c5..db812c5 100644 --- a/cses/BitStrings/main.cpp +++ b/cses/IntroductoryProblems/BitStrings/main.cpp diff --git a/cses/BitStrings/main_input0.txt b/cses/IntroductoryProblems/BitStrings/main_input0.txt index 00750ed..00750ed 100644 --- a/cses/BitStrings/main_input0.txt +++ b/cses/IntroductoryProblems/BitStrings/main_input0.txt diff --git a/cses/BitStrings/main_output0.txt b/cses/IntroductoryProblems/BitStrings/main_output0.txt index 45a4fb7..45a4fb7 100644 --- a/cses/BitStrings/main_output0.txt +++ b/cses/IntroductoryProblems/BitStrings/main_output0.txt diff --git a/cses/IncreasingArray/main b/cses/IntroductoryProblems/IncreasingArray/main Binary files differindex 6306d7c..6306d7c 100755 --- a/cses/IncreasingArray/main +++ b/cses/IntroductoryProblems/IncreasingArray/main diff --git a/cses/IncreasingArray/main.cpp b/cses/IntroductoryProblems/IncreasingArray/main.cpp index 67f6afe..67f6afe 100644 --- a/cses/IncreasingArray/main.cpp +++ b/cses/IntroductoryProblems/IncreasingArray/main.cpp diff --git a/cses/IncreasingArray/main_input0.txt b/cses/IntroductoryProblems/IncreasingArray/main_input0.txt index 6e41d58..6e41d58 100644 --- a/cses/IncreasingArray/main_input0.txt +++ b/cses/IntroductoryProblems/IncreasingArray/main_input0.txt diff --git a/cses/IncreasingArray/main_output0.txt b/cses/IntroductoryProblems/IncreasingArray/main_output0.txt index 7ed6ff8..7ed6ff8 100644 --- a/cses/IncreasingArray/main_output0.txt +++ b/cses/IntroductoryProblems/IncreasingArray/main_output0.txt diff --git a/cses/MissingNumber/main b/cses/IntroductoryProblems/MissingNumber/main Binary files differindex 3c1baa1..3c1baa1 100755 --- a/cses/MissingNumber/main +++ b/cses/IntroductoryProblems/MissingNumber/main diff --git a/cses/MissingNumber/main.cpp b/cses/IntroductoryProblems/MissingNumber/main.cpp index 77f0f06..77f0f06 100644 --- a/cses/MissingNumber/main.cpp +++ b/cses/IntroductoryProblems/MissingNumber/main.cpp diff --git a/cses/MissingNumber/main_input0.txt b/cses/IntroductoryProblems/MissingNumber/main_input0.txt index 58c8e41..58c8e41 100644 --- a/cses/MissingNumber/main_input0.txt +++ b/cses/IntroductoryProblems/MissingNumber/main_input0.txt diff --git a/cses/MissingNumber/main_input1.txt b/cses/IntroductoryProblems/MissingNumber/main_input1.txt index d284270..d284270 100644 --- a/cses/MissingNumber/main_input1.txt +++ b/cses/IntroductoryProblems/MissingNumber/main_input1.txt diff --git a/cses/MissingNumber/main_output0.txt b/cses/IntroductoryProblems/MissingNumber/main_output0.txt index b8626c4..b8626c4 100644 --- a/cses/MissingNumber/main_output0.txt +++ b/cses/IntroductoryProblems/MissingNumber/main_output0.txt diff --git a/cses/MissingNumber/main_output1.txt b/cses/IntroductoryProblems/MissingNumber/main_output1.txt index 1994202..1994202 100644 --- a/cses/MissingNumber/main_output1.txt +++ b/cses/IntroductoryProblems/MissingNumber/main_output1.txt diff --git a/cses/IntroductoryProblems/PalindromeReorder/main.cpp b/cses/IntroductoryProblems/PalindromeReorder/main.cpp new file mode 100644 index 0000000..411cda8 --- /dev/null +++ b/cses/IntroductoryProblems/PalindromeReorder/main.cpp @@ -0,0 +1,30 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int n; + string s; + cin >> s; + map<char, int> mp; + int e = 0, o = 0; + for (auto ch : s) { + mp[ch]++; + } + if (n & 1) { + for (auto [key, value] : mp) { + if (value & 1) { + o++; + } else { + e++; + } + } + if (o > 1) { + cout << "NO SOLUTION" << '\n'; + } + } else { + + } +} diff --git a/cses/Permutations/main b/cses/IntroductoryProblems/Permutations/main Binary files differindex ebb51a1..ebb51a1 100755 --- a/cses/Permutations/main +++ b/cses/IntroductoryProblems/Permutations/main diff --git a/cses/Permutations/main.cpp b/cses/IntroductoryProblems/Permutations/main.cpp index 2f55cc4..2f55cc4 100644 --- a/cses/Permutations/main.cpp +++ b/cses/IntroductoryProblems/Permutations/main.cpp diff --git a/cses/Permutations/main_input0.txt b/cses/IntroductoryProblems/Permutations/main_input0.txt index 7ed6ff8..7ed6ff8 100644 --- a/cses/Permutations/main_input0.txt +++ b/cses/IntroductoryProblems/Permutations/main_input0.txt diff --git a/cses/Permutations/main_input1.txt b/cses/IntroductoryProblems/Permutations/main_input1.txt index 00750ed..00750ed 100644 --- a/cses/Permutations/main_input1.txt +++ b/cses/IntroductoryProblems/Permutations/main_input1.txt diff --git a/cses/Permutations/main_output0.txt b/cses/IntroductoryProblems/Permutations/main_output0.txt index 8205ff8..8205ff8 100644 --- a/cses/Permutations/main_output0.txt +++ b/cses/IntroductoryProblems/Permutations/main_output0.txt diff --git a/cses/Permutations/main_output1.txt b/cses/IntroductoryProblems/Permutations/main_output1.txt index 303530c..303530c 100644 --- a/cses/Permutations/main_output1.txt +++ b/cses/IntroductoryProblems/Permutations/main_output1.txt diff --git a/cses/Repetitions/main b/cses/IntroductoryProblems/Repetitions/main Binary files differindex e124ce4..e124ce4 100755 --- a/cses/Repetitions/main +++ b/cses/IntroductoryProblems/Repetitions/main diff --git a/cses/Repetitions/main.cpp b/cses/IntroductoryProblems/Repetitions/main.cpp index cc45f63..cc45f63 100644 --- a/cses/Repetitions/main.cpp +++ b/cses/IntroductoryProblems/Repetitions/main.cpp diff --git a/cses/Repetitions/main_input0.txt b/cses/IntroductoryProblems/Repetitions/main_input0.txt index a6c74b2..a6c74b2 100644 --- a/cses/Repetitions/main_input0.txt +++ b/cses/IntroductoryProblems/Repetitions/main_input0.txt diff --git a/cses/Repetitions/main_output0.txt b/cses/IntroductoryProblems/Repetitions/main_output0.txt index 00750ed..00750ed 100644 --- a/cses/Repetitions/main_output0.txt +++ b/cses/IntroductoryProblems/Repetitions/main_output0.txt diff --git a/cses/TrailingZeros/main b/cses/IntroductoryProblems/TrailingZeros/main Binary files differindex b251f72..b251f72 100755 --- a/cses/TrailingZeros/main +++ b/cses/IntroductoryProblems/TrailingZeros/main diff --git a/cses/TrailingZeros/main.cpp b/cses/IntroductoryProblems/TrailingZeros/main.cpp index e41854e..e41854e 100644 --- a/cses/TrailingZeros/main.cpp +++ b/cses/IntroductoryProblems/TrailingZeros/main.cpp diff --git a/cses/TrailingZeros/main_input0.txt b/cses/IntroductoryProblems/TrailingZeros/main_input0.txt index 209e3ef..209e3ef 100644 --- a/cses/TrailingZeros/main_input0.txt +++ b/cses/IntroductoryProblems/TrailingZeros/main_input0.txt diff --git a/cses/TrailingZeros/main_output0.txt b/cses/IntroductoryProblems/TrailingZeros/main_output0.txt index b8626c4..b8626c4 100644 --- a/cses/TrailingZeros/main_output0.txt +++ b/cses/IntroductoryProblems/TrailingZeros/main_output0.txt diff --git a/cses/TrailingZeros/test.py b/cses/IntroductoryProblems/TrailingZeros/test.py index 3f46e57..3f46e57 100755 --- a/cses/TrailingZeros/test.py +++ b/cses/IntroductoryProblems/TrailingZeros/test.py diff --git a/cses/TrailingZeros/test.txt b/cses/IntroductoryProblems/TrailingZeros/test.txt index d5d7d1b..d5d7d1b 100644 --- a/cses/TrailingZeros/test.txt +++ b/cses/IntroductoryProblems/TrailingZeros/test.txt diff --git a/cses/IntroductoryProblems/TwoSets/main b/cses/IntroductoryProblems/TwoSets/main Binary files differnew file mode 100755 index 0000000..ed99e71 --- /dev/null +++ b/cses/IntroductoryProblems/TwoSets/main diff --git a/cses/IntroductoryProblems/TwoSets/main.cpp b/cses/IntroductoryProblems/TwoSets/main.cpp new file mode 100644 index 0000000..bec99d9 --- /dev/null +++ b/cses/IntroductoryProblems/TwoSets/main.cpp @@ -0,0 +1,41 @@ +#include<bits/stdc++.h> + +using namespace std; + +typedef long long ll; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + ll n; + cin >> n; + ll sum = (n * (n + 1)) / 2; + ll s = sum / 2; + if (sum & 1) { + cout << "NO" << '\n'; + } else { + cout << "YES" << '\n'; + vector<bool> a(n + 1); + for (int i = n; i >= 1; i--) { + if (s <= i) { + a[s] = true; + break; + } + s -= i; + a[i] = true; + } + int c1 = count(a.begin() + 1, a.end(), false); + cout << c1 << '\n'; + for (int i = 1; i <= n; i++) { + if (a[i] == false) { + cout << i << ' '; + } + } + cout << '\n' << n - c1 << '\n'; + for (int i = 1; i <= n; i++) { + if (a[i] == true) { + cout << i << ' '; + } + } + } +} diff --git a/cses/TwoSets/main_input0.txt b/cses/IntroductoryProblems/TwoSets/main_input0.txt index 7f8f011..7f8f011 100644 --- a/cses/TwoSets/main_input0.txt +++ b/cses/IntroductoryProblems/TwoSets/main_input0.txt diff --git a/cses/TwoSets/main_input1.txt b/cses/IntroductoryProblems/TwoSets/main_input1.txt index 1e8b314..1e8b314 100644 --- a/cses/TwoSets/main_input1.txt +++ b/cses/IntroductoryProblems/TwoSets/main_input1.txt diff --git a/cses/TwoSets/main_output0.txt b/cses/IntroductoryProblems/TwoSets/main_output0.txt index 90d1101..90d1101 100644 --- a/cses/TwoSets/main_output0.txt +++ b/cses/IntroductoryProblems/TwoSets/main_output0.txt diff --git a/cses/TwoSets/main_output1.txt b/cses/IntroductoryProblems/TwoSets/main_output1.txt index 5e35d1b..5e35d1b 100644 --- a/cses/TwoSets/main_output1.txt +++ b/cses/IntroductoryProblems/TwoSets/main_output1.txt diff --git a/cses/WeirdAlgorithm/main b/cses/IntroductoryProblems/WeirdAlgorithm/main Binary files differindex 39ec9c4..39ec9c4 100755 --- a/cses/WeirdAlgorithm/main +++ b/cses/IntroductoryProblems/WeirdAlgorithm/main diff --git a/cses/WeirdAlgorithm/main.cpp b/cses/IntroductoryProblems/WeirdAlgorithm/main.cpp index ab5b099..ab5b099 100644 --- a/cses/WeirdAlgorithm/main.cpp +++ b/cses/IntroductoryProblems/WeirdAlgorithm/main.cpp diff --git a/cses/WeirdAlgorithm/main_input0.txt b/cses/IntroductoryProblems/WeirdAlgorithm/main_input0.txt index 00750ed..00750ed 100644 --- a/cses/WeirdAlgorithm/main_input0.txt +++ b/cses/IntroductoryProblems/WeirdAlgorithm/main_input0.txt diff --git a/cses/WeirdAlgorithm/main_output0.txt b/cses/IntroductoryProblems/WeirdAlgorithm/main_output0.txt index 4c544cf..4c544cf 100644 --- a/cses/WeirdAlgorithm/main_output0.txt +++ b/cses/IntroductoryProblems/WeirdAlgorithm/main_output0.txt diff --git a/cses/SortingAndSearching/DistinctNumbers/main.cpp b/cses/SortingAndSearching/DistinctNumbers/main.cpp new file mode 100644 index 0000000..6e03958 --- /dev/null +++ b/cses/SortingAndSearching/DistinctNumbers/main.cpp @@ -0,0 +1,16 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int n; + cin >> n; + set<int> st; + while(n--) { + int x; cin >> x; + st.insert(x); + } + cout << st.size() << '\n'; +} diff --git a/cses/TwoSets/main b/cses/TwoSets/main Binary files differdeleted file mode 100755 index 61c6ec3..0000000 --- a/cses/TwoSets/main +++ /dev/null diff --git a/cses/TwoSets/main.cpp b/cses/TwoSets/main.cpp deleted file mode 100644 index 8c1aed0..0000000 --- a/cses/TwoSets/main.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include<bits/stdc++.h> - -using namespace std; - -typedef long long ll; - -int main () { - ios_base::sync_with_stdio(false); - cin.tie(NULL); - ll n; - cin >> n; - ll sum = (n * (n + 1)) / 2; - ll s = sum / 2; - set<int> vis; - vector<int> st2; - if (sum & 1) { - cout << "NO" << '\n'; - } else { - cout << "YES" << '\n'; - for (int i = n; i >= 1; --i) { - if (s - i > 0) { - s -= i; - vis.insert(i); - } else { - vis.insert(s); - s -= i; - break; - } - } - for (int i = 1; i <= n; ++i) { - if (!vis.count(i)) { - st2.push_back(i); - } - } - cout << vis.size() << '\n'; - for (auto x : vis) { - cout << x << " "; - } - cout << '\n'; - cout << st2.size() << '\n'; - for (auto x : st2) { - cout << x << " "; - } - cout << '\n'; - } -} diff --git a/cubesShuffling/main b/cubesShuffling/main Binary files differnew file mode 100755 index 0000000..d5ae401 --- /dev/null +++ b/cubesShuffling/main diff --git a/cubesShuffling/main.cpp b/cubesShuffling/main.cpp new file mode 100644 index 0000000..20c107c --- /dev/null +++ b/cubesShuffling/main.cpp @@ -0,0 +1,41 @@ +#include<bits/stdc++.h> +#include <functional> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + freopen("cubes.in", "r", stdin); + int tt; + cin >> tt; + int cnt = 0; + while(tt--) { + cnt++; + int n; + cin >> n; + vector<int> v(n); + vector<int> ans(n); + for (auto &x : v) cin >> x; + sort(v.begin(), v.end()); + cout << "Case " << cnt << ":\n"; + int j = 0; + if (n & 1) { + ans[n / 2] = v[0]; + for(int i = 0; i < n / 2; i++) { + ans[n - 1 - i] = v[(n - 1) - j]; // 4 2 // 4 + ans[i] = v[(n - 2) - j]; // 3 1 / 0 + j += 2; + } + } else { + for(int i = 0; i < n / 2; i++) { + ans[n - 1 - i] = v[(n - 1) - j]; + ans[i] = v[(n - 2) - j]; + j += 2; + } + } + for (int i = 0; i < n; i++) { + cout << ans[i] << " \n"[i == n - 1]; + } + } +} diff --git a/cubesShuffling/main_input0.txt b/cubesShuffling/main_input0.txt new file mode 100644 index 0000000..3150c53 --- /dev/null +++ b/cubesShuffling/main_input0.txt @@ -0,0 +1,5 @@ +2 +3 +1 2 3 +5 +4 5 2 1 3 diff --git a/cubesShuffling/main_output0.txt b/cubesShuffling/main_output0.txt new file mode 100644 index 0000000..980ed86 --- /dev/null +++ b/cubesShuffling/main_output0.txt @@ -0,0 +1,4 @@ +Case 1: +2 1 3 +Case 2: |
