#include <iostream>
using namespace std;
int main() {
int a, b, c = 0;
cin >> a >> b;
int A[a][b];
for(int y = 0; y<a; ++y) {
for (int x = 0; x < b; ++x) {
cin >> A[y][x];
}
}
for(int y = 0, y1 = a - 1; y<=y1; ++y, --y1) {
for (int x = 0, x1 = b - 1; x<b; ++x, --x1) {
int k = A[y][x];
A[y][x] = A[y1][x1];
A[y1][x1] = k;
}
}
for(int y = 0; y<a; ++y) {
for (int x = 0; x < b; ++x) {
cout << A[y][x] << ' ';
}
cout << endl;
}
}
3 3
1 2 3
4 5 6
7 8 9
9 8 7
4 5 6 // тут нужно 6 5 4
3 2 1
#include <iostream>
using namespace std;
int main() {
int a = 0, b = 0, c = 0;
cin >> a >> b;
int A[a*b]; // not all compilers support this you have to make sure or use new/unique_ptr
for (int i = 0; i < a*b; ++i) {
cin >> A[i];
}
for (int i = 0; i < a*b / 2; ++i) {
std::swap(A[i], A[a*b - 1 - i]);
}
for (int i = 0; i < a*b; ++i) {
if ((i) % b == 0)
std::cout << std::endl;
std::cout << A[i] << " ";
}
}