forked from vedantpople4/problem_solving_cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1339A.cpp
More file actions
40 lines (34 loc) · 685 Bytes
/
Copy path1339A.cpp
File metadata and controls
40 lines (34 loc) · 685 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<iostream>
#include<queue>
using namespace std;
queue<int> a, b, c;
int main(void)
{
int n, ca, cb, cc, q;
ca= cb= cc= 0;
cin>>n;
for(int i= 1; i<=n; i++){
cin>>q;
if(q == 1){
ca++;
a.push(i);
}
else if(q == 2){
cb++;
b.push(i);
}
else{
cc++;
c.push(i);
}
}
int mn= min(ca, min(cb, cc));
cout<< mn <<endl;
while(mn--){
cout<< a.front() << " "<< b.front() << " "<< c.front() <<endl;
a.pop();
b.pop();
c.pop();
}
return 0;
}