Submission #167438

# Submission time Handle Problem Language Result Execution time Memory
167438 2019-12-08T14:53:44 Z Lightning Red-blue table (IZhO19_stones) C++14
27 / 100
29 ms 1400 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <stack>
#include <queue>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;

#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define F first
#define S second
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define fo(a, b, c, d) for(int (a) = (b); (a) <= (c); (a) += (d))
#define foo(a, b, c ,d) for(int (a) = (b); (a) >= (c); (a) -= (d))
//#define int ll

const int N = 2e5;
const int INF = 1e9;

void solve(int n, int m) {
	if(n >= m) {
		int need = m / 2 + 1;
		cout << n + (m - need) <<'\n';
		fo(i, 1, n, 1) {
			fo(j, 1, m, 1) {
				if(j <= need) cout << '+';
				else cout << '-';
			}
			cout << '\n';
		}
	} else {
		int need = n / 2 + 1;
		cout << m + (n - need) <<'\n';
		fo(i, 1, n, 1) {
			fo(j, 1, m, 1) {
				if(i <= need) cout << '-';
				else cout << '+';
			}
			cout << '\n';
		}
	}
}

int t;

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> t;
	fo(it, 1, t, 1) {
		int n, m;
		cin >> n >> m;
		solve(n, m);
	}
	return 0;
}









# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 380 KB Output is correct
4 Incorrect 4 ms 376 KB Wrong answer in test 5 29: 31 < 32
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 1400 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 1400 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 380 KB Output is correct
4 Incorrect 4 ms 376 KB Wrong answer in test 5 29: 31 < 32