답안 #499707

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
499707 2021-12-29T09:39:03 Z SOIVIEONE Red-blue table (IZhO19_stones) C++14
27 / 100
38 ms 1488 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 322222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const ll MOD = 1000000007ll;

ll bn(ll aa, ll n)
{
    ll r = 1ll;
    for(; n > 0; n >>= 1ll)
    {
        if(n & 1)
            r = (r * aa) % MOD;
        aa = (aa * aa) % MOD;
    }
    return r;

}

const ld pi = 2 * acos(0.0);
//template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

char a[1234][1234];
void solve()
{
    int n, m;
    cin >> n >> m;

    int ans = 0;
    if(n < m)
    {
        for(int i = 1; i <= n; i ++)
            for(int j = 1; j <= m; j ++)
            {
                if(i <= n / 2 + 1)
                    a[i][j] = '-';
                else
                    a[i][j] = '+';
            }
        ans = m + max(0, n - n / 2 - 1);
    }
    else
    {
        for(int i = 1; i <= n; i ++)
            for(int j = 1; j <= m; j ++)
            {
                if(j <= m / 2 + 1)
                    a[i][j] = '+';
                else
                    a[i][j] = '-';
            }
        ans = n + max(0, m - m / 2 - 1);
    }
    cout << ans << '\n';
    for(int i = 1; i <= n; i ++, cout << '\n')
        for(int j = 1; j <= m; j ++)
            cout << a[i][j];
}


int main()
{
    int t = 1;
    cin >> t;
    while(t --)
        solve();
    return 0;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Incorrect 3 ms 332 KB Wrong answer in test 5 29: 31 < 32
# 결과 실행 시간 메모리 Grader output
1 Incorrect 32 ms 1424 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 38 ms 1488 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Incorrect 3 ms 332 KB Wrong answer in test 5 29: 31 < 32