Submission #330748

# Submission time Handle Problem Language Result Execution time Memory
330748 2020-11-26T13:08:41 Z tavhid Red-blue table (IZhO19_stones) C++14
0 / 100
84 ms 1408 KB
#include <bits/stdc++.h>

//#pragma GCC optimize("Ofast")
//1.0 * clock() / CLOCKS_PER_SEC

#define fi first
#define se second
#define int long long int
#define dl double long

using namespace std;

const int N = 1e6 + 7;
const int INF = 1e10 + 7;
const int mod = 998244353;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve1()
{
    int n, m;
    cin >> n >> m;
    if(m > n){
        int x = m / 2 + 1;
        int y = n / 2 - 1;
        if(n % 2 == 1)
            y++;
        cout << y * 2 + (m - x) * 2 << endl;
        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                if((j < x && i < y) || (j + 1 > m - x && i + 1 > n - y)){
                    cout << '+';
                }else{
                    cout << '-';
                }
            }
            cout << endl;
        }
    }else{
        int x = m / 2 - 1;
        if(m % 2 == 1)
            x++;
        int y = n / 2 + 1;
        cout << x * 2 + (n - y) * 2 << endl;
        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                if((j < x && i < y) || (j + 1 > m - x && i + 1 > n - y)){
                    cout << '-';
                }else{
                    cout << '+';
                }
            }
            cout << endl;
        }
    }
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );
	//freopen( "cupboard.in" , "r" , stdin );
    //freopen( "cupboard.out" , "w" , stdout );

    int cghf = 1;cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB in the table A+B is not equal to 2
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 364 KB in the table A+B is not equal to 0
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB in the table A+B is not equal to 2
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 84 ms 1388 KB in the table A+B is not equal to 76
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 1408 KB in the table A+B is not equal to 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB in the table A+B is not equal to 2
2 Halted 0 ms 0 KB -