File tree Expand file tree Collapse file tree 2 files changed +46
-1
lines changed
Codeforces Round #320 (Div. 2) [Bayan Thanks-Round] Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 678
678
13463792
679
679
13443199
680
680
13465613
681
- 13486876
681
+ 13486876
682
+ 13502850
You can’t perform that action at this time.
0 commit comments