제출 #788580

#제출 시각아이디문제언어결과실행 시간메모리
788580TheOpChickenRed-blue table (IZhO19_stones)C++17
0 / 100
43 ms1300 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
	int t;
	cin >> t;
	while(t--){
		int n, m;
		cin >> n >> m;

		int opt = 0, can = -1;
		for (int i = 0; i <= n; i++){
			int total = (n-i)*m + i*(m - (m/2+1)), need = n/2 + 1;
			int new_can = min(total/need, m);
			if (new_can+i > opt+can) opt = i, can = new_can;
		}

		vector<int> count(m, 0);

		cout << can + opt << endl;
		for (int i = 0; i < n; i++){
			int row_need = m/2 + 1;
			for (int j = 0; j < m; j++){
				if (i >= opt) cout << '-';
				else{
					if (row_need == m - j || count[j] == n/2 + 1){
						cout << '+';
						row_need--;
					}
					else{
						cout << '-';
						count[j]++;
					}
				}
			}

			cout << endl;
		}
	}
}
#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...