답안 #690879

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
690879 2023-01-30T13:55:04 Z Nuraly_Serikbay Red-blue table (IZhO19_stones) C++14
38 / 100
28 ms 1292 KB
/* Speech to the young */
 
//#include <bits/stdc++.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
#include <unordered_map>
 
using namespace std;
 
#define pb push_back
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define YOSIK() ios_base::sync_with_stdio(0),cin.tie(0)
#define int long long
#define pans cout << "\n------ans-------\n" 
 
const int N = 1e6 + 10;
const int INF = 1e18 + 7;
const int MOD = 1e9 + 7;
const int P = 31;

int n, m; 

void Solution () {
	cin >> n >> m;
	if (n <= m && n <= 4) {
		cout << (n / 2 - (1 - (n % 2))) + m << '\n';
		for (int i = 1; i <= n; ++ i) {
			for (int j = 1; j <= m; ++ j) {
				if (i <= n / 2 + 1) cout << "-";
				else cout << '+';
			}
			cout << '\n';
		}
		return;
	}
	if (n >= m && m <= 4) {
		cout << (m / 2 - (1 - (m % 2))) + n << '\n';
		for (int i = 1; i <= n; ++ i) {
			for (int j = 1; j <= m; ++ j) {
				if (j <= m / 2 + 1) cout << "+";
				else cout << '-';
			}
			cout << '\n';
		}
		return;
	}
	cout << n + m - 2 << '\n';
	for (int i = 1; i <= n; ++ i) {
		for (int j = 1; j < m; ++ j) {
			if (j % 2 == 1) {
				if (i <= (n / 2 + 1)) cout << "-";
				else cout << "+";
			} else {
				if (i >= (n / 2 + 1)) cout << "-";
				else cout << "+";
			}
		}
		cout << "+\n";
	}
	
	return;
}
 
signed main () {
	YOSIK();
//	precalc();
	int T = 1; 
	cin >> T;
	while (T --) Solution ();
	exit (0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Incorrect 2 ms 340 KB in the table A+B is not equal to 41
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 1272 KB Output is correct
2 Correct 17 ms 1220 KB Output is correct
3 Correct 16 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 28 ms 1292 KB in the table A+B is not equal to 46
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Incorrect 2 ms 340 KB in the table A+B is not equal to 41
5 Halted 0 ms 0 KB -