aboutsummaryrefslogtreecommitdiff
path: root/11/dec/gold/photo.cpp
diff options
context:
space:
mode:
Diffstat (limited to '11/dec/gold/photo.cpp')
-rw-r--r--11/dec/gold/photo.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/11/dec/gold/photo.cpp b/11/dec/gold/photo.cpp
new file mode 100644
index 0000000..3492b8c
--- /dev/null
+++ b/11/dec/gold/photo.cpp
@@ -0,0 +1,22 @@
+#include <bits/stdc++.h>
+using namespace std;
+
+int A[5][20005];
+
+int main {
+ int N;
+ cin >> N;
+ for (int i = 0; i < 5; i++) {
+ for (int j = 0; j < N; j++) cin >> A[i][j];
+ }
+ unordered_map<int, int> m[5];
+ for (int i = 0; i < 5; i++) {
+ for (int j = 0; j < N; j++) m[i][A[i][j]] = j;
+ }
+ sort(A[0], A[0] + N, [&m](const int& a, const int& b) {
+ int c[2] = { 0 };
+ for (int i = 0; i < 5; i++) c[m[i][a] < m[i][b]]++;
+ return c[0] < c[1];
+ });
+ for (int i = 0; i < N; i++) cout << A[0][i] << '\n';
+}