From f3f70407d91f0fbae19158cd5436d31386d70971 Mon Sep 17 00:00:00 2001 From: nxtsourav7 Date: Sun, 29 Dec 2024 13:02:14 +0600 Subject: [PATCH] level 7 --- Codeforces/Div-2/1831/A_Twin_Permutations.cpp | 32 ++++++++++++++++++ Codeforces/Div-2/1979/B_XOR_Sequences.cpp | 33 +++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 Codeforces/Div-2/1831/A_Twin_Permutations.cpp create mode 100644 Codeforces/Div-2/1979/B_XOR_Sequences.cpp diff --git a/Codeforces/Div-2/1831/A_Twin_Permutations.cpp b/Codeforces/Div-2/1831/A_Twin_Permutations.cpp new file mode 100644 index 0000000..5fc6579 --- /dev/null +++ b/Codeforces/Div-2/1831/A_Twin_Permutations.cpp @@ -0,0 +1,32 @@ +/** + * author : nxtsourav7 + * created : 2024-12-29 02:50:33 +**/ + +#include +using namespace std; + +void S0LVE() { + int n; + cin >> n; + vector a(n); + for(int &x : a) cin >> x; + + for(int i = 0; i < n; ++i) { + cout << abs(n + 1 - a[i]) << ' '; + } +} + +int32_t main() { + ios::sync_with_stdio(false); + cin.tie(nullptr); + + int Q; + cin >> Q; + while(Q--) { + S0LVE(); + cout << '\n'; + } + + return 0; +} \ No newline at end of file diff --git a/Codeforces/Div-2/1979/B_XOR_Sequences.cpp b/Codeforces/Div-2/1979/B_XOR_Sequences.cpp new file mode 100644 index 0000000..c5f01c9 --- /dev/null +++ b/Codeforces/Div-2/1979/B_XOR_Sequences.cpp @@ -0,0 +1,33 @@ +/** + * author : nxtsourav7 + * created : 2024-12-29 03:11:27 +**/ + +#include +using namespace std; + +void S0LVE() { + int x, y; + cin >> x >> y; + + for(int i = 0; i < 30; ++i) { + if(((x >> i) & 1) != ((y >> i) & 1)) { + cout << (1 << i); + return; + } + } +} + +int32_t main() { + ios::sync_with_stdio(false); + cin.tie(nullptr); + + int Q; + cin >> Q; + while(Q--) { + S0LVE(); + cout << '\n'; + } + + return 0; +} \ No newline at end of file