Submission #788580

# Submission time Handle Problem Language Result Execution time Memory
788580 2023-07-20T11:29:02 Z TheOpChicken Red-blue table (IZhO19_stones) C++17
0 / 100
43 ms 1300 KB
#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 time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB in the table A+B is not equal to 5
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 320 KB in the table A+B is not equal to 5
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB in the table A+B is not equal to 5
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 1188 KB in the table A+B is not equal to 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 1300 KB in the table A+B is not equal to 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB in the table A+B is not equal to 5
3 Halted 0 ms 0 KB -