Submission #498529

# Submission time Handle Problem Language Result Execution time Memory
498529 2021-12-25T11:46:52 Z The_Samurai Red-blue table (IZhO19_stones) C++
0 / 100
2 ms 292 KB
#include <bits/stdc++.h>

using namespace std;

void solve() {
	int n, m, ans, x = 1;
	
	cin >> n >> m;
	if (n == 1) {
		cout << m << '\n';
		for (int i = 0; i < m; i++) {
			cout << '-';
		}
		cout << '\n';
		return;
	}
	if (n == 2) {
		cout << m << '\n';
		for (int i = 0; i < m; i++) {
			cout << '-';
		}
		cout << '\n';
		for (int i = 0; i < m; i++) {
			cout << '-';
		}
		cout << '\n';
		return;
	}
	if (n == 3) {
		cout << m + 1 << '\n';
		for (int i = 0; i < 2; i++) {
			for (int j = 0; j < m; j++) {
				cout << '-';
			}
			cout << '\n';
		}
		for (int i = 0; i < m; i++) {
			cout << '+';
		}
		cout << '\n';
		return;
	}
	if (m <= 2) {
		cout << n << '\n';
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				cout << '+';
			}
			cout << '\n';
		}
		return;
	}
	if (m == 3) {
		cout << n + 1 << '\n';
		for (int i = 0; i < n; i++) {
			cout << "++-\n";
		}
		cout << '\n';
		return;
	}
}

int main() {
	int t;
	
	cin >> t;
	while (t--) {
		solve();
	}
}

Compilation message

stones.cpp: In function 'void solve()':
stones.cpp:6:12: warning: unused variable 'ans' [-Wunused-variable]
    6 |  int n, m, ans, x = 1;
      |            ^~~
stones.cpp:6:17: warning: unused variable 'x' [-Wunused-variable]
    6 |  int n, m, ans, x = 1;
      |                 ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 292 KB Wrong answer in test 2 1: 1 < 2
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 284 KB Wrong answer in test 2 1: 1 < 2
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 292 KB Wrong answer in test 2 1: 1 < 2
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 292 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 -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 292 KB Wrong answer in test 2 1: 1 < 2