Submission #1066707

# Submission time Handle Problem Language Result Execution time Memory
1066707 2024-08-20T05:11:01 Z 김은성(#11121) Gardening (RMI21_gardening) C++17
5 / 100
13 ms 1020 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[6][200009];
int n, m;
int cnt = 0;
void fill1(int r0, int c0, int rows, int cols){
	cnt++;
	for(int i=0; i<rows; i++)
		for(int j=0; j<cols; j++)
			a[r0+i][c0+j] = cnt;
}
void printanswer(){
	printf("YES\n");
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++)
			printf("%d ", a[i][j]);
		printf("\n");
	}
}
int main(){
	ll k;
	int t;
	scanf("%d", &t);
	while(t--){
		scanf("%d %d %lld", &n, &m, &k);
		cnt = 0;
		if(n%2 || m%2)
			printf("NO\n");
		else if(n==2){
			if(k == m/2){
				for(int i=0; i<m; i+=2)
					fill1(0, i, 2, 2);
				printanswer();
			}
			else
				printf("NO\n");
		}
		else{
			if(k%2==0 && m/2 <= k && k <= m){
				for(int i=0; i<(m-k)/2; i++){
					fill1(0, 4*i, 4, 4);
					fill1(1, 4*i+1, 2, 2);
				}
				for(int i=2*(m-k); i<m; i+=2){
					fill1(0, i, 2, 2);
					fill1(2, i, 2, 2);
				}
				printanswer();
			}
			else
				printf("NO\n");
		}
	}
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:24:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |  scanf("%d", &t);
      |  ~~~~~^~~~~~~~~~
Main.cpp:26:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |   scanf("%d %d %lld", &n, &m, &k);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 13 ms 1020 KB Correct! Azusa and Laika like the garden :)
# Verdict Execution time Memory Grader output
1 Correct 13 ms 1020 KB Correct! Azusa and Laika like the garden :)
2 Failed 6 ms 604 KB Incorrect output
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 1020 KB Correct! Azusa and Laika like the garden :)
2 Failed 6 ms 604 KB Incorrect output
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 1020 KB Correct! Azusa and Laika like the garden :)
2 Failed 6 ms 604 KB Incorrect output
3 Halted 0 ms 0 KB -