aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTa180m2020-02-15 17:10:26 -0600
committerGitHub2020-02-15 17:10:26 -0600
commit3d9b4c9af4d76c6df2dbb5a54cc0e5eb26906322 (patch)
tree95167f4b0c873953452bd8ed9fa989459df89eba
parentd3038ce8694c8a3df7bc37e48547cebea5c69651 (diff)
Create photo.cpp
-rw-r--r--2011/December/Gold/photo.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/2011/December/Gold/photo.cpp b/2011/December/Gold/photo.cpp
new file mode 100644
index 0000000..3492b8c
--- /dev/null
+++ b/2011/December/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';
+}