You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
616 B

#include <bits/stdc++.h>
using namespace std;
const int N = 15;
double a[N], c[N], d[N];
int b[N], cl, dl;
int main() {
int n = 10;
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= n; i++) cin >> b[i];
for (int i = 1; i <= n; i++)
if (b[i] == 1)
c[++cl] = a[i];
else
d[++dl] = a[i];
sort(c + 1, c + 1 + 5);
sort(d + 1, d + 1 + 5, greater<double>());
for (int i = 1; i <= 5; i++)
printf("%d %.2f\n", 1, c[i]);
for (int i = 1; i <= 5; i++)
printf("%d %.2f\n", 1, c[i]);
return 0;
}