# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
591337 | OmnitronX | Coins (LMIO19_monetos) | C++14 | 16 ms | 1048 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |