Submission #591337

#TimeUsernameProblemLanguageResultExecution timeMemory
591337OmnitronXCoins (LMIO19_monetos)C++14
0 / 100
16 ms1048 KiB
#include <iostream> using namespace std; using num = int; num tab[301][301]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); num temp; num n; cin >> temp >> n >> temp >> temp; for (num i = 0; i < n; ++i) { for (num j = 0; j < n; ++j) { cin >> tab[i][j]; } } num counter = 0; for (num i = 0; i < n/2; ++i) { for (num j = 0; j < n/2; ++j) { if (tab[i][j] == 1) { ++counter; tab[i][j] = 0; } } } for (num i = n / 2; i < n; ++i) { for (num j = n / 2; j < n; ++j) { if (tab[i][j] == 0) { --counter; tab[i][j] = 1; } } } if (counter > 0) { for (num i = 0; i < n / 2; ++i) { for (num j = n / 2; j < n; ++j) { if (counter == 0) { for (num i = 0; i < n; ++i) { for (num j = 0; j < n; ++j) { cout << tab[i][j] << ' '; } cout << '\n'; } return 0; } if (tab[i][j] == 0) { --counter; tab[i][j] = 1; } } } for (num i = n/2; i < n; ++i) { for (num j = 0; j < n / 2; ++j) { if (counter == 0) { for (num i = 0; i < n; ++i) { for (num j = 0; j < n; ++j) { cout << tab[i][j] << ' '; } cout << '\n'; } return 0; } if (tab[i][j] == 0) { --counter; tab[i][j] = 1; } } } } else { for (num i = 0; i < n / 2; ++i) { for (num j = n / 2; j < n; ++j) { if (counter == 0) { for (num i = 0; i < n; ++i) { for (num j = 0; j < n; ++j) { cout << tab[i][j] << ' '; } cout << '\n'; } return 0; } if (tab[i][j] == 1) { ++counter; tab[i][j] = 0; } } } for (num i = n / 2; i < n; ++i) { for (num j = 0; j < n / 2; ++j) { if (counter == 0) { for (num i = 0; i < n; ++i) { for (num j = 0; j < n; ++j) { cout << tab[i][j] << ' '; } cout << '\n'; } return 0; } if (tab[i][j] == 1) { ++counter; tab[i][j] = 0; } } } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...