| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 157885 | mrboorger | Red-blue table (IZhO19_stones) | C++14 | 0 ms | 0 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define F first
#define S second
#define ll long long
#define ld long double#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define F first
#define S second
#define ll long long
#define ld long double
#define sqr(x) (x) * (x)
//#define all(a) a.begin(), a.end()
using namespace std;
using namespace __gnu_pbds;
//typedef tree<
//pair <int, int>,
//null_type,
//greater<pair <int, int>>,
//rb_tree_tag,
//tree_order_statistics_node_update>
//ordered_set;
const int maxn = 1002;
char a[maxn][maxn];
int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    for(int ii = 0; ii < t; ++ii)
    {
        int n, m;
        cin >> n >> m;
        if (n >= m)
        {
            int ans = 0;
            for(int i = 0; i < n; ++i)
            {
                ++ans;
                for(int j = 0; j < m / 2 + (m + 1) % 2; ++j)
                    a[i][j] = '+';
            }
            for(int j = m / 2 + (m + 1) % 2; j < m; ++j)
            {
                ++ans;
                for(int i = 0; i < n; ++i)
                    a[i][j] = '-';
            }
            cout << ans << '\n';
            for(int i = 0; i < n; ++i)
            {
                for(int j = 0; j < m; ++j)
                    cout << a[i][j];
                cout << '\n';
            }
        }
        else
        {
            int ans = 0;
            for(int j = 0; j < m; ++j)
            {
                ++ans;
                for(int i = 0; i < n / 2 + (n + 1) % 2; ++i)
                    a[i][j] = '-';
            }
            for(int i = n / 2 + (n + 1) % 2; i < n; ++i)
            {
                ++ans;
                for(int j = 0; j < m; ++j)
                    a[i][j] = '+';
            }
            cout << ans << '\n';
            for(int i = 0; i < n; ++i)
            {
                for(int j = 0; j < m; ++j)
                    cout << a[i][j];
                cout << '\n';
            }
        }
    }
    return 0;
}
#define sqr(x) (x) * (x)
//#define all(a) a.begin(), a.end()
using namespace std;
using namespace __gnu_pbds;
//typedef tree<
//pair <int, int>,
//null_type,
//greater<pair <int, int>>,
//rb_tree_tag,
//tree_order_statistics_node_update>
//ordered_set;
const int maxn = 1002;
char a[maxn][maxn];
int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    for(int ii = 0; ii < t; ++ii)
    {
        int n, m;
        cin >> n >> m;
        if (n >= m)
        {
            int ans = 0;
            for(int i = 0; i < n; ++i)
            {
                ++ans;
                for(int j = 0; j < m / 2 + m % 2; ++j)
                    a[i][j] = '+';
            }
            for(int j = m / 2 + m % 2; j < m; ++j)
            {
                ++ans;
                for(int i = 0; i < n; ++i)
                    a[i][j] = '-';
            }
            cout << ans << '\n';
            for(int i = 0; i < n; ++i)
            {
                for(int j = 0; j < m; ++j)
                    cout << a[i][j];
                cout << '\n';
            }
        }
        else
        {
            int ans = 0;
            for(int j = 0; j < m; ++j)
            {
                ++ans;
                for(int i = 0; i < n / 2 + n % 2; ++i)
                    a[i][j] = '-';
            }
            for(int i = n / 2 + n % 2; i < n; ++i)
            {
                ++ans;
                for(int j = 0; j < m; ++j)
                    a[i][j] = '+';
            }
            cout << ans << '\n';
            for(int i = 0; i < n; ++i)
            {
                for(int j = 0; j < m; ++j)
                    cout << a[i][j];
                cout << '\n';
            }
        }
    }
    return 0;
}
