File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+
3
+ using namespace std ;
4
+
5
+ int main ()
6
+ {
7
+ while ()
8
+ {
9
+ int n;
10
+ cin>>n;
11
+ std::vector<int > a (n), b (n), c (n), ans;
12
+
13
+ for (int i=0 ; i<n; i++)
14
+ {
15
+ cin>>a[i];
16
+ }
17
+ for (int i=0 ; i<n; i++)
18
+ {
19
+ cin>>b[i];
20
+ }
21
+ for (int i=0 ; i<n; i++)
22
+ {
23
+ cin>>c[i];
24
+ }
25
+ ans.push_back (a[0 ]);
26
+
27
+ for (int i=1 ; i<n; i++)
28
+ {
29
+ if (i == (n-1 ))
30
+ {
31
+ if (ans[ans.size ()-1 ] != a[i] && a[i] != ans[0 ])
32
+ ans.push_back (a[i]);
33
+ else if (ans[ans.size ()-1 ] != b[i] && b[i] != ans[0 ])
34
+ ans.push_back (b[i]);
35
+ else if (ans[ans.size ()-1 ] != c[i] && c[i] != ans[0 ])
36
+ ans.push_back (c[i]);
37
+ }
38
+ else if (ans[ans.size ()-1 ] != a[i])
39
+ ans.push_back (a[i]);
40
+
41
+ else if (ans[ans.size ()-1 ] != b[i])
42
+ ans.push_back (b[i]);
43
+
44
+ else if (ans[ans.size ()-1 ] != c[i])
45
+ ans.push_back (c[i]);
46
+ }
47
+ for (auto i : ans)
48
+ cout<<i<<" " ;
49
+ cout<<endl;
50
+ }
51
+ return 0 ;
52
+ }
You can’t perform that action at this time.
0 commit comments