제출 #1131125

#제출 시각아이디문제언어결과실행 시간메모리
1131125TsaganaRed-blue table (IZhO19_stones)C++20
100 / 100
20 ms2352 KiB
#include<bits/stdc++.h>

#define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define all(x) x.begin(), x.end()
#define int long long
#define pq priority_queue
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define F first
#define S second

using namespace std;

void solve () {
	int n, m; cin >> n >> m;
	
	bool id = 0;
	if (n < m) {swap(n, m); id = 1;}
	
	char a[n][m];
	for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) a[i][j] = '+';
	
	int ans = n, x = 0, c = 0;
	for (int k = 0; k < (m-1)/2; k++)
	for (int y = 0; y < n; y++) {
		a[y][x] = '-'; c++;
		if (c == n/2+1) {x++; c = 0; ans++;}
	}
	
	cout << ans << '\n';
	if (!id)
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) cout << a[i][j];
		cout << '\n';
	}
	else
	for (int j = 0; j < m; j++) {
		for (int i = 0; i < n; i++) cout << (a[i][j] == '+' ? '-' : '+');
		cout << '\n';
	}
}
signed main() {IOS int t; cin >> t; while (t--) solve(); return 0;}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...