Submission #488197

# Submission time Handle Problem Language Result Execution time Memory
488197 2021-11-18T07:20:32 Z OttincaM Red-blue table (IZhO19_stones) C++14
0 / 100
24 ms 1224 KB
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <climits>
#include <queue>
#include <fstream>
#include <iomanip>
 
using namespace std;

#define all(x) (x).begin(), (x).end()
//#define int long long
#define ll long long
#define ff first
#define ss second
#define MP make_pair
#define pb push_back
#define pf push_front
#define db double
 
ll gcd(ll a,ll b){
    return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a,ll b){
    return a / gcd(a, b) * b;
}

ll binary_power(ll a,ll n){
    ll res = 1;
    while(n){
        if(n & 1)   -- n, res = res * a;
        else a = a * a, n >>= 1;
    }
    return res;
}

ll phi(ll n) {
	ll result = n;
	for (ll i = 2; i * i <= n; ++i)
		if (n % i == 0) {
			while (n % i == 0)
				n /= i;
			result -= result / i;
		}
	if (n > 1)
		result -= result / n;
	return result;
}
/*<______________________________________________>*/

const int MOD = 1e9 + 7;
const int INF = 1000000101;
const long long LLINF = 1223372000000000555;



void t_main(){
    int n, m, res, cnt; cin >> n >> m;
    bool a = false;
    if(m > n) a = true;
    vector <vector<bool>> g(n + 1, vector <bool> (m + 1, a));
    
    res = max(n, m); cnt = (min(n, m) + 1) / 2 - 1;
    res += cnt;
    
    if(!a){
        for(int i = 1; i <= cnt; i ++){
            for(int j = 1; j <= m; j ++)
                g[i][j] = g[i][j] ^ 1;
        }
    } 
    else{
        for(int i = 1; i <= cnt; i ++){
            for(int j = 1; j <= m; j ++)
                g[j][i] = g[j][i] ^ 1;
        }
    }
    cout << res << "\n";
    for(int i = 1; i <= n; i ++){
        for(int j = 1; j <= m; j ++)
            cout << (g[i][j] ? '-' : '+');
        cout << "\n";
    }
    cerr << "<----->\n";
}
 
 
signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tt = 1;
    cin >> tt;
    while(tt --) t_main();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB in the table A+B is not equal to 4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB in the table A+B is not equal to 4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 1224 KB in the table A+B is not equal to 35
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB in the table A+B is not equal to 4
2 Halted 0 ms 0 KB -