# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
591337 | OmnitronX | Coins (LMIO19_monetos) | C++14 | 16 ms | 1048 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |