답안 #523782

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
523782 2022-02-08T07:32:21 Z veos Red-blue table (IZhO19_stones) C++11
100 / 100
42 ms 2248 KB
#include <iostream>
using namespace std;
int main(){
	int k;
	cin>>k;
	while(k>0){
		int n,m;
		cin>>n>>m;
		char swapped=false;
		if(n<m){
			m^=n^=m^=n;
			swapped=true;
		}
		char b[n][m];
		for(int i=0;i<n;i++){
			for(int y=0;y<m;y++){
				b[i][y]='+';
			}
		}
		int ans=n;
		int c=0,x=0;
		for(int i=0;i<(m-1)/2;i++){
			for(int y=0;y<n;y++){
				b[y][x]='-';
				c++;
				if(c==n/2+1){
					x++;
					c=0;
					ans++;
				}
			}
		}
		cout<<ans<<endl;
		if(!swapped){
			for(int y=0;y<n;y++){
				for(int x=0;x<m;x++){
					cout<<b[y][x];
				}
				cout<<"\n";
			}
		}
		else{
			for(int y=0;y<m;y++){
				for(int x=0;x<n;x++){
					cout<<(b[x][y]=='+'?'-':'+');
				}
				cout<<"\n";
			}
		}
		k--;
	}
	//Matchonov Muhammad
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 4 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 1276 KB Output is correct
2 Correct 32 ms 1812 KB Output is correct
3 Correct 27 ms 1776 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 1236 KB Output is correct
2 Correct 26 ms 1612 KB Output is correct
3 Correct 31 ms 1276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 4 ms 296 KB Output is correct
5 Correct 42 ms 1276 KB Output is correct
6 Correct 32 ms 1812 KB Output is correct
7 Correct 27 ms 1776 KB Output is correct
8 Correct 32 ms 1236 KB Output is correct
9 Correct 26 ms 1612 KB Output is correct
10 Correct 31 ms 1276 KB Output is correct
11 Correct 10 ms 460 KB Output is correct
12 Correct 25 ms 1352 KB Output is correct
13 Correct 26 ms 1356 KB Output is correct
14 Correct 19 ms 1048 KB Output is correct
15 Correct 31 ms 2248 KB Output is correct
16 Correct 24 ms 1696 KB Output is correct
17 Correct 10 ms 800 KB Output is correct