| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1338558 | rafsanamin2020 | Gardening (RMI21_gardening) | C++20 | 10 ms | 512 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1E9 + 7, MX = 1E6 + 2;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int T;
cin >> T;
for (int t = 1; t <= T; t++)
{
int n, m, k;
cin >> n >> m >> k;
if (n % 2 == 0)
{
vector<vector<int>> g(m, vector<int>(m, 0));
if ((n * n) / 4 == k)
{
int strt = 1;
int rev = 0;
for (int i = 0; i < m; i++)
{
for (int j = 0; j < m; j++)
{
if ((j == m - 1) && (m % 2 > 0))
{
g[i][j] = strt + (j / 2) - 1;
}
else
{
g[i][j] = strt + (j / 2);
}
}
if (rev)
{
reverse(g[i].begin(), g[i].end());
}
if (i % 2 == 1 && i != m - 2)
{
strt += (m / 2);
rev ^= 1;
}
// cout << "\n";
}
map<int, int> mapping;
int ans = (n * n) / 4;
while (ans > 0)
{
if (ans < k)
{
k--;
}
mapping[ans] = k;
ans--;
}
for (int i = 0; i < m; i++)
{
for (int j = 0; j < m; j++)
{
g[i][j] = mapping[g[i][j]];
}
}
for (vector<int> x : g)
{
for (int y : x)
{
cout << y << " ";
}
cout << "\n";
}
}
else if (n / 2 == k)
{
for (int i = 0; i < m; i++)
{
for (int j = 0; j < m; j++)
{
g[i][j] = min(min(i, m - i - 1), min(j, m - j - 1));
g[i][j]++;
cout << g[i][j] << " ";
}
cout << "\n";
}
}
else
{
cout << "NO\n";
}
}
else
{
cout << "NO\n";
}
}
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
