#include #include #include using namespace std; int main() { int matrix[4][4] = { {2, 4, 6, 8}, {10, 12, 14, 16}, {18, 19, 20, 22}, {24, 26, 28, 30} }; vector combined; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { combined.push_back(matrix[i][j]); } } int n; cin >> n; for (int i = 0; i < n; i++) { int num; cin >> num; combined.push_back(num); } sort(combined.rbegin(), combined.rend()); vector> result(4, vector(4)); int index = 0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { result[i][j] = combined[index++]; } } for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { cout << result[i][j] << " "; } cout << endl; } return 0; }