Вам нужно написать программу, которая содержит только требуемую функцию (можно несколько функций, если одна функция будет вызывать другую). Программа не должна содержать никакого кода вне функций.
В тестирующей системе после вашей программы будет добавлен следующий код, после чего решение будет проверено на тестах.
int main() { int n; cin >> n; vector <vector<int>> a = solution(n); for (int i = 0; i < a.size(); ++i) { for (int j = 0; j < a[i].size(); ++j) cout << a[i][j] << " "; cout << endl; } return 0; }
int main() { int n; cin >> n; vector <vector<int>> a = solution(n); for (int i = 0; i < a.size(); ++i) { for (int j = 0; j < a[i].size(); ++j) cout << a[i][j] << " "; cout << endl; } return 0; }
int main() { int n, m; cin >> n >> m; vector <vector<int>> a(n, vector<int>(m)); for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) cin >> a[i][j]; int i, j; cin >> i >> j; swap_columns(a, i, j); for (int i = 0; i < a.size(); ++i) { for (int j = 0; j < a[i].size(); ++j) cout << a[i][j] << " "; cout << endl; } return 0; }
int main() { int n; cin >> n; vector <vector<int>> a(n, vector<int>(n)); for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) cin >> a[i][j]; cout << boolalpha << is_symmetric(a) << endl; return 0; }
int main() { int n; cin >> n; vector <vector<int>> a(n, vector<int>(n)); for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) cin >> a[i][j]; int k; cin >> k; vector <int> res = kth_diagonal(a, k); for (int i = 0; i < res.size(); ++i) cout << res[i] << " "; cout << endl; return 0; }
int main() { int n; cin >> n; vector <vector<int>> a(n, vector<int>(n)); for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) cin >> a[i][j]; swap_diagonals(a); for (int i = 0; i < a.size(); ++i) { for (int j = 0; j < a[i].size(); ++j) cout << a[i][j] << " "; cout << endl; } return 0; }
int main() { int n, m; cin >> n >> m; vector <vector<int>> a = fill(n, m); for (int i = 0; i < a.size(); ++i) { for (int j = 0; j < a[i].size(); ++j) cout << setw(4) << a[i][j]; cout << endl; } return 0; }
int main() { int n, m; cin >> n >> m; vector <vector<int>> a(n, vector<int>(m)), a_copy, res; for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) cin >> a[i][j]; a_copy = a; res = transpose(a); if (a != a_copy) { cout << "Source array has been modified" << endl; } for (int i = 0; i < res.size(); ++i) { for (int j = 0; j < res[i].size(); ++j) cout << res[i][j] << " "; cout << endl; } return 0; }
int main() { int n; cin >> n; vector <vector<int>> a(n, vector<int>(n)); for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) cin >> a[i][j]; transpose(a); for (int i = 0; i < a.size(); ++i) { for (int j = 0; j < a[i].size(); ++j) cout << a[i][j] << " "; cout << endl; } return 0; }
int main() { int n, m; cin >> n >> m; vector <int> a(n * m), a_copy; vector <vector<int>> res; for (int i = 0; i < n * m; ++i) cin >> a[i]; a_copy = a; res = convert(a, n, m); if (a != a_copy) { cout << "Source array has been modified" << endl; } for (int i = 0; i < res.size(); ++i) { for (int j = 0; j < res[i].size(); ++j) cout << res[i][j] << " "; cout << endl; } return 0; }
int main() { int n, m; cin >> n >> m; vector <vector<int>> a = fill(n, m); for (int i = 0; i < a.size(); ++i) { for (int j = 0; j < a[i].size(); ++j) cout << setw(4) << a[i][j]; cout << endl; } return 0; }
int main() { int n, m; cin >> n >> m; vector <vector<int>> a(n, vector<int>(m)), a_copy, res; for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) cin >> a[i][j]; a_copy = a; res = rotate(a); if (a != a_copy) { cout << "Source array has been modified" << endl; } for (int i = 0; i < res.size(); ++i) { for (int j = 0; j < res[i].size(); ++j) cout << res[i][j] << " "; cout << endl; } return 0; }
int main() { int n; cin >> n; vector <vector<int>> a(n, vector<int>(n)); for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) cin >> a[i][j]; rotate(a); for (int i = 0; i < a.size(); ++i) { for (int j = 0; j < a[i].size(); ++j) cout << a[i][j] << " "; cout << endl; } return 0; }
int main() { int n, m; cin >> n >> m; vector <vector<int>> a = fill(n, m); for (int i = 0; i < a.size(); ++i) { for (int j = 0; j < a[i].size(); ++j) cout << setw(4) << a[i][j]; cout << endl; } return 0; }
int main() { int n, m; cin >> n >> m; vector <vector<int>> a = fill(n, m); for (int i = 0; i < a.size(); ++i) { for (int j = 0; j < a[i].size(); ++j) cout << setw(4) << a[i][j]; cout << endl; } return 0; }