#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 |
1 |
Incorrect |
1 ms |
340 KB |
improper placement |
2 |
Incorrect |
1 ms |
340 KB |
improper placement |
3 |
Incorrect |
12 ms |
980 KB |
improper placement |
4 |
Incorrect |
16 ms |
964 KB |
improper placement |
5 |
Incorrect |
15 ms |
1048 KB |
improper placement |
6 |
Incorrect |
11 ms |
968 KB |
improper placement |
7 |
Incorrect |
12 ms |
1032 KB |
improper placement |
8 |
Incorrect |
10 ms |
980 KB |
improper placement |
9 |
Incorrect |
11 ms |
980 KB |
improper placement |
10 |
Incorrect |
11 ms |
980 KB |
improper placement |