# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1066979 |
2024-08-20T09:13:56 Z |
정희우(#11124) |
Gardening (RMI21_gardening) |
C++17 |
|
200 ms |
860 KB |
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
using lint = long long;
using vint = vector<int>;
using pii = pair<int,int>;
const int CUTLINE=4500;
int a1[200000][60];
int a2[60][200000];
int a3[5000][5000];
void sqr(int s,int e,int l,int r,int c,int t)
{
if(t==1)
for(int i=s;i<e;i++)
for(int j=l;j<r;j++)
a1[i][j]=c;
else if(t==2)
for(int i=s;i<e;i++)
for(int j=l;j<r;j++)
a2[i][j]=c;
else
for(int i=s;i<e;i++)
for(int j=l;j<r;j++)
a3[i][j]=c;
}
void fillmp(int s,int e,int l,int r,int c,int t)
{
int n=(e-s)/2,m=(r-l)/2;
while(c!=n*m)
{
if(c-1<=(n-1)*(m-1)-2 || c-1==(n-1)*(m-1))
{
sqr(s,e,l,l+1,c,t);
sqr(s,e,r-1,r,c,t);
sqr(s,s+1,l,r,c,t);
sqr(e-1,e,l,r,c,t);
s++,e--,l++,r--,c--;
}
else if(n>m)
{
for(int j=0;j<m;j++)
sqr(s,s+2,l+j*2,l+j*2+2,c--,t);
s+=2;
}
else
{
for(int i=0;i<n;i++)
sqr(s+i*2,s+i*2+2,l,l+2,c--,t);
l+=2;
}
n=(e-s)/2,m=(r-l)/2;
}
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
sqr(s+i*2,s+i*2+2,l+j*2,l+j*2+2,c--,t);
}
int main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int T;
cin >> T;
while(T--)
{
int n,m,k;
cin >> n >> m >> k;
if(n%2 || m%2)
{
cout << "NO\n";
continue;
}
if(k>n*m/4 || k==n*m/4-1 || k<max(n,m)/2)
{
cout << "NO\n";
continue;
}
if(n>CUTLINE)
{
fillmp(0,n,0,m,k,1);
cout << "YES\n";
for(int i=0;i<n;i++,cout << '\n')
for(int j=0;j<m;j++)
cout << a1[i][j] << ' ';
}
else if(m>CUTLINE)
{
fillmp(0,n,0,m,k,2);
cout << "YES\n";
for(int i=0;i<n;i++,cout << '\n')
for(int j=0;j<m;j++)
cout << a2[i][j] << ' ';
}
else
{
fillmp(0,n,0,m,k,3);
cout << "YES\n";
for(int i=0;i<n;i++,cout << '\n')
for(int j=0;j<m;j++)
cout << a3[i][j] << ' ';
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
860 KB |
Correct! Azusa and Laika like the garden :) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
860 KB |
Correct! Azusa and Laika like the garden :) |
2 |
Correct |
6 ms |
604 KB |
Correct! Azusa and Laika like the garden :) |
3 |
Correct |
6 ms |
604 KB |
Correct! Azusa and Laika like the garden :) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
860 KB |
Correct! Azusa and Laika like the garden :) |
2 |
Correct |
6 ms |
604 KB |
Correct! Azusa and Laika like the garden :) |
3 |
Correct |
6 ms |
604 KB |
Correct! Azusa and Laika like the garden :) |
4 |
Execution timed out |
1073 ms |
348 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1050 ms |
604 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1031 ms |
600 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
860 KB |
Correct! Azusa and Laika like the garden :) |
2 |
Correct |
6 ms |
604 KB |
Correct! Azusa and Laika like the garden :) |
3 |
Correct |
6 ms |
604 KB |
Correct! Azusa and Laika like the garden :) |
4 |
Execution timed out |
1073 ms |
348 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |