Submission #474951

# Submission time Handle Problem Language Result Execution time Memory
474951 2021-09-20T10:58:22 Z fuad27 Red-blue table (IZhO19_stones) C++17
0 / 100
100 ms 2244 KB
#include<bits/stdc++.h>
using namespace std;
int main () {
	int t;
	cin >> t;
	while(t--) {
		char red = '+', blue = '-';
		int n, m;
		bool swapped = false;
		cin >> n >> m;
		if(n < m) {
			swap(n, m);
			swap(red, blue);
			swapped = true;
		}
		char table[n][m];
		for(int i = 0;i<n;i++) {
			for(int j = 0;j<m;j++)table[i][j] = red;
		}
		int cnt = 0, ans = n;
		for(int asdf = 0;asdf<(m-1)/2;asdf++) {
			for(int i = 0;i<n;i++) {
				table[i][ans-n]=blue;
				cnt++;
				if(cnt == (n/2) + 1) {
					ans++;
					cnt = 0;
				}
			}
		}
		cout<<ans<<endl;
		if(!swapped) {
		for(int i = 0;i<n;i++) {
			for(int j = 0;j<m;j++) {
				cout<<table[i][j]<<' ';
			}
			cout<<endl;
		}
		}
		else {
		for(int i = 0;i<m;i++) {
			for(int j = 0;j<n;j++) {
				cout<<table[j][i];
			}
			cout<<endl;
		}
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 260 KB Wrong answer
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 99 ms 1740 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 100 ms 2244 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Wrong answer
2 Halted 0 ms 0 KB -