답안 #667757

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
667757 2022-12-02T02:04:03 Z gavgav Gardening (RMI21_gardening) C++14
0 / 100
24 ms 736 KB
#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){
                printf("%lld", answer[i][0]);
                for(ll j=1;j<colsNumber;++j){
                    printf(" %lld", answer[i][j]);
                }
                printf("\n");
            }
        }
        else
            printf("NO\n");
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:9:26: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     ll testsNumber; scanf("%lld", &testsNumber);
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
Main.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%lld%lld%lld", &rowsNumber, &colsNumber, &colorsNumber);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Failed 24 ms 596 KB Output contains flowers without two equal neighbours
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Failed 24 ms 596 KB Output contains flowers without two equal neighbours
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Failed 24 ms 596 KB Output contains flowers without two equal neighbours
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Failed 12 ms 736 KB Output contains flowers without two equal neighbours
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Failed 4 ms 468 KB Output contains flowers without two equal neighbours
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Failed 24 ms 596 KB Output contains flowers without two equal neighbours
2 Halted 0 ms 0 KB -