Skip to content

Commit 3b45374

Browse files
committed
Added problem 579B from codeforces
1 parent 399e592 commit 3b45374

File tree

2 files changed

+46
-1
lines changed
  • codeforces
    • Codeforces Round #320 (Div. 2) [Bayan Thanks-Round]

2 files changed

+46
-1
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// http://codeforces.com/contest/579/problem/B
2+
3+
#include<bits/stdc++.h>
4+
using namespace std;
5+
6+
struct p {
7+
int x, y, c;
8+
};
9+
10+
int main() {
11+
int n;
12+
cin >> n;
13+
14+
n *= 2;
15+
map< int, pair<int, int> > mapa;
16+
17+
18+
for (int i = 1; i < n; ++i) {
19+
for (int j = 0; j < i; ++j) {
20+
int t;
21+
cin >> t;
22+
mapa[t] = make_pair(i, j);
23+
}
24+
}
25+
26+
map< int, pair<int, int> > :: reverse_iterator it = mapa.rbegin();
27+
28+
vector<int> ans(n, 0);
29+
while (it != mapa.rend()) {
30+
pair<int, int> cur = it -> second;
31+
int x = cur.first;
32+
int y = cur.second;
33+
34+
if (!ans[y] && !ans[x]) {
35+
ans[y] = x + 1;
36+
ans[x] = y + 1;
37+
}
38+
39+
it ++;
40+
}
41+
42+
for (int i = 0; i < n; ++i) cout << ans[i] << " ";
43+
return 0;
44+
}

codeforces/data.db

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,4 +678,5 @@
678678
13463792
679679
13443199
680680
13465613
681-
13486876
681+
13486876
682+
13502850

0 commit comments

Comments
 (0)