답안 #1093911

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1093911 2024-09-28T04:57:07 Z stdfloat Red-blue table (IZhO19_stones) C++17
27 / 100
19 ms 1492 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define all(v) (v).begin(), (v).end()

void solve() {
	int n, m;
	cin >> n >> m;

	vector<vector<char>> a(n, vector<char>(m));
	if (n < m) {
		for (int i = 0; i < n; i++) {
			if (i < ((n - 1) >> 1)) {
				for (int j = 0; j < m; j++)
					a[i][j] = '+';
			}
			else {
				for (int j = 0; j < m; j++)
					a[i][j] = '-';
			}
		}
	}
	else {
		for (int i = 0; i < m; i++) {
			if (i < ((m - 1) >> 1)) {
				for (int j = 0; j < n; j++)
					a[j][i] = '-';
			}
			else {
				for (int j = 0; j < n; j++)
					a[j][i] = '+';
			}
		}
	}

	cout << max(m, n) + (min(m, n) - 1 >> 1) << '\n';
	for (auto i : a) {
		for (auto j : i)
			cout << j;
		cout << '\n';
	}
	cout << '\n';
}

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);

	int T;
	cin >> T;
	while (T--) solve();
}

Compilation message

stones.cpp: In function 'void solve()':
stones.cpp:38:33: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
   38 |  cout << max(m, n) + (min(m, n) - 1 >> 1) << '\n';
      |                       ~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 2 ms 348 KB Wrong answer in test 5 29: 31 < 32
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 19 ms 1492 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 1372 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 2 ms 348 KB Wrong answer in test 5 29: 31 < 32
5 Halted 0 ms 0 KB -