Submission #742401

# Submission time Handle Problem Language Result Execution time Memory
742401 2023-05-16T08:25:27 Z salmon Gardening (RMI21_gardening) C++14
0 / 100
21 ms 5332 KB
#include <bits/stdc++.h>
using namespace std;
int t;
int N,M,K;
vector<int> lst[200100];

int main(){

	scanf(" %d",&t);

	while(t--){
		scanf(" %d",&N);
		scanf(" %d",&M);
		scanf(" %d",&K);

		if(M * (long long int) N > 200000 || N % 2 == 1 || M % 2 == 1 || K * 4 > M * N){
			printf("NO\n");
			continue;
		}

		if(N == 2){
			if(K == M / 2){
                printf("YES\n");
				for(int i = 0; i < M; i++){
					printf("%d ",i / 2 + 1);
				}
				printf("\n");
				for(int i = 0; i < M; i++){
					printf("%d ",i / 2 + 1);
				}
				printf("\n");
			}
			else{
                printf("NO\n");
			}
		}
		else if(N == 4 && M == 2){
			if(K == 2){
				printf("YES\n");
				printf("1 1\n1 1\n2 2\n2 2\n");
			}
			else{
				printf("NO\n");
			}
		}
		else if(N == 4){
            int cont = 1;
            if(K >= N * M / 4 / 2){
                printf("YES\n");

                int num = N * M / 4 - K - 1;

                if(num == -1){
                    for(int i = 0; i < M; i++){
                        printf("%d ",i / 2 + 1);
                    }
                    printf("\n");
                    for(int i = 0; i < M; i++){
                        printf("%d ",i / 2 + 1);
                    }
                    printf("\n");
                    for(int i = 0; i < M; i++){
                        printf("%d ",i / 2 + M / 2 + 1);
                    }
                    printf("\n");
                    for(int i = 0; i < M; i++){
                        printf("%d ",i / 2 + M / 2 + 1);
                    }
                    printf("\n");
                }
                else if(num == 0){
                    printf("NO\n");
                }
                else{
                    for(int i = 0; i < num * 2 + 2; i++){
                        printf("1 ");
                    }
                    for(int i = num * 2 + 2; i < M; i++){
                        printf("%d ",i / 2 + 1);
                    }
                    printf("\n");

                    printf("1 ");
                    for(int i = 1; i < num * 2 + 1; i++){
                        printf("%d ", (i + 1)/2 + 1);
                    }
                    printf("1 ");
                    for(int i = num * 2 + 2; i < M; i++){
                        printf("%d ",i / 2 + 1);
                    }
                    printf("\n");

                    printf("1 ");
                    for(int i = 1; i < num * 2 + 1; i++){
                        printf("%d ", (i + 1)/2 + 1);
                    }
                    printf("1 ");
                    for(int i = num * 2 + 2; i < M; i++){
                        printf("%d ",i / 2 + M / 2 - num);
                    }
                    printf("\n");

                    for(int i = 0; i < num * 2 + 2; i++){
                        printf("1 ");
                    }
                    for(int i = num * 2 + 2; i < M; i++){
                        printf("%d ",i / 2 + M / 2 - num);
                    }
                    printf("\n");
                }
            }
            else{
                printf("NO\n");
            }
		}

	}


}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:47:17: warning: unused variable 'cont' [-Wunused-variable]
   47 |             int cont = 1;
      |                 ^~~~
Main.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf(" %d",&t);
      |  ~~~~~^~~~~~~~~~
Main.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf(" %d",&N);
      |   ~~~~~^~~~~~~~~~
Main.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf(" %d",&M);
      |   ~~~~~^~~~~~~~~~
Main.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf(" %d",&K);
      |   ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Failed 21 ms 5332 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 21 ms 5332 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 21 ms 5332 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 4 ms 4948 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 3 ms 4948 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 21 ms 5332 KB Incorrect output
2 Halted 0 ms 0 KB -