summaryrefslogtreecommitdiff
path: root/introductory_problems/two_sets.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'introductory_problems/two_sets.cpp')
-rw-r--r--introductory_problems/two_sets.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/introductory_problems/two_sets.cpp b/introductory_problems/two_sets.cpp
new file mode 100644
index 0000000..ce13e0c
--- /dev/null
+++ b/introductory_problems/two_sets.cpp
@@ -0,0 +1,27 @@
+// 1092. Two Sets
+#include <bits/stdc++.h>
+using namespace std;
+
+int main() {
+ static int n;
+ scanf("%d", &n);
+ if (n % 4 == 1 || n % 4 == 2)
+ printf("NO\n");
+ else if (n % 4 == 3) {
+ printf("YES\n");
+ printf("%d\n", n / 2);
+ for (int i = 2; i <= n / 2; i += 2)
+ printf("%d %d ", i, n - i);
+ printf("%d\n%d\n", n, n / 2 + 1);
+ for (int i = 1; i <= n / 2; i += 2)
+ printf("%d %d ", i, n - i);
+ } else {
+ printf("YES\n");
+ printf("%d\n", n / 2);
+ for (int i = 2; i <= n / 2; i += 2)
+ printf("%d %d ", i, n - i + 1);
+ printf("\n%d\n", n / 2);
+ for (int i = 1; i <= n / 2; i += 2)
+ printf("%d %d ", i, n - i + 1);
+ }
+}