# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
667753 | gavgav | Gardening (RMI21_gardening) | C++17 | 27 ms | 928 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>
#include <vector>
#define ll long long
#define vec vector
using namespace std;
int main() {
ll testsNumber; scanf("%lld", &testsNumber);
for(ll t=0;t<testsNumber;++t){
ll rowsNumber, colsNumber, colorsNumber;
scanf("%lld%lld%lld", &rowsNumber, &colsNumber, &colorsNumber);
if((rowsNumber/2)*(colsNumber/2)>=colorsNumber){
printf("YES\n");
vec<vec<ll> > answer (rowsNumber, vec<ll>(colsNumber, 0));
ll curColorsNumber=1;
for(ll i=0;i<rowsNumber/2;++i){
for(ll j=0;j<colsNumber/2 && curColorsNumber<=colorsNumber;++j){
answer[i*2][j*2]=curColorsNumber;
++curColorsNumber;
}
}
ll last=0;
for(ll i=0;i<rowsNumber;++i){
for(ll j=0;j<colsNumber;++j){
last=max(last, answer[i][j]);
answer[i][j]=last;
}
last=0;
}
for(ll i=0;i<colsNumber;++i){
for(ll j=0;j<rowsNumber;++j){
last=max(last, answer[j][i]);
answer[j][i]=last;
}
last=0;
}
for(ll i=0;i<rowsNumber;++i){
for(ll j=0;j<colsNumber;++j){
printf("%lld ", answer[i][j]);
}
printf("\n");
}
}
else
printf("NO\n");
}
}
Compilation message (stderr)
# | 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... |