Submission #171879

# Submission time Handle Problem Language Result Execution time Memory
171879 2019-12-30T14:49:37 Z Dilshod_Imomov Red-blue table (IZhO19_stones) C++17
27 / 100
79 ms 1480 KB
# include <bits/stdc++.h>
# pragma GCC optimize("Ofast")
# define pb push_back
# define ll long long
# define fi first
# define se second
# define all(vc) vc.begin(),vc.end()
# define forn(i, n) for (int i = 0; i < int(n); i++)
# define ford(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define fore(i, l, r) for (int i = int(l); i < int(r); i++)
# define fors(i, s) for (int i = 0; s[i]; i++)
# define in freopen("input.txt", "r", stdin)
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define time cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
# define debug(x) cerr << #x << ": " << x << endl; 

using namespace std;
 
const ll INF = 1e18;
const int mod = 1e9 + 7;
const int N = 1e5 + 7;

void solve()
{
	int n, m;
	cin >> n >> m;
	if ( n >= m ) {
		int blue = (m - 1) / 2;
		int red = m - blue;
		cout << n + blue << endl;
		forn( i, n ) {
			forn( j, blue ) cout << "-";
			forn( j, red ) cout << "+";
			cout << endl;
		}
	}
	else {
		int red = (n - 1) / 2;
		int blue = n - red;
		cout << m + red << endl;
		forn( i, blue ) {
			forn( j, m ) cout << "-";
			cout << endl;
		}
		forn( i, red ) {
			forn( j, m ) cout << "+";
			cout << endl;
		}
	}
}

int main()
{
	speed;
	int t;
	cin >> t;
	while ( t-- ) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 15 ms 376 KB Output is correct
4 Incorrect 23 ms 504 KB Wrong answer in test 5 29: 31 < 32
# Verdict Execution time Memory Grader output
1 Incorrect 79 ms 1480 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 54 ms 1372 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 252 KB Output is correct
3 Correct 15 ms 376 KB Output is correct
4 Incorrect 23 ms 504 KB Wrong answer in test 5 29: 31 < 32