답안 #207246

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
207246 2020-03-06T19:45:37 Z hasegawananako Red-blue table (IZhO19_stones) C++17
27 / 100
71 ms 1400 KB
#define _USE_MATH_DEFINES
#define forn(i, n) for(int i=0; i<n; i++)
#define forn1(i, n) for(int i=1; i<n; i++)
#define elif else if
#define lli long long int
#define _USE_MATH_DEFINES

#define _CRT_SECURE_NO_WARNINGS


//#include <bits/stdc++.h>

#include <stdlib.h>
#include <limits.h>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <cmath>
#include <numeric>
#include <map>
#include <unordered_map>
#include <vector>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <stack>
#include <chrono>

using namespace std;

//Constant vars

const lli MOD = 1000000007, LIM = 4294967295;


//Vars

lli n, m, a, b, c, d, e, f, l, t, q, mass[1000000], mass1[1000000], mass2[1000000];


lli C[2000][2000];

string s;

//Structures

map<lli, lli> myints, arr;
unordered_map<lli, lli> been;
vector<int> mm, mm1;



int compare(const void * a, const void * b) {

	return -((*(lli*)a) - (*(lli*)b));

};

void pascalTriangle() {

	for (int n = 0; n <= 1999; ++n) {
		C[n][0] = C[n][n] = 1;
		for (int k = 1; k < n; ++k)
			C[n][k] = C[n - 1][k - 1] + C[n - 1][k];
	}

}

lli gcd(lli a, lli b) {

	while (b != 0) {

		lli t = b;
		b = a % b;
		a = t;

	}

	return a;

}

lli gcdex(lli a, lli b, lli & x, lli & y) {
	if (a == 0) {
		x = 0; y = 1;
		return b;
	}
	lli x1, y1;
	lli d = gcdex(b%a, a, x1, y1);
	x = y1 - (b / a) * x1;
	y = x1;
	return d;
}

lli NOK(lli n1, lli n2) {

	return n1 * n2 / gcd(n1, n2);

}

lli bin_pow(lli base, lli p) {
	if (p == 1) {
		return base;
	}
	if (p == 0) {
		return 1;
	}

	if (p % 2 == 0) {
		lli t = bin_pow(base, p / 2);
		return t * t % MOD;
	}
	else {
		return bin_pow(base, p - 1) * base % MOD;
	}
}

lli inverse_element(lli x) {
	return bin_pow(x, MOD - 2);
}

//(a / b) mod m
lli divide(lli a, lli b) {
	return a * inverse_element(b) % MOD;
}

int main() {

	//freopen("input10000.txt", "r", stdin);
	//freopen("output10000.txt", "w", stdout);

	ios::sync_with_stdio(0);
	cin.tie();

	cin >> n;

	forn(i, n) {

		cin >> a >> b;


		if (a == 2 || b == 2) {

			cout << max(a, b) << endl;

		}
		else {

			cout << max(a, b) + min(a, b) / 2 + (min(a, b) % 2 == 0 ? -1 : 0)  << endl;

		}

		

		if (a < b) {

			forn(i, a / 2 + 1) {

				forn(j, b) {

					cout << '-';

				}

				cout << endl;

			}

			forn(i, a / 2 + ( a % 2 == 0 ? -1 : 0)) {

				forn(j, b) {

					cout << '+';

				}

				cout << endl;

			}

		}
		else {



			forn(i, a) {

				forn(j, b / 2 + (b % 2 == 0 ? -1 : 0)) {

					cout << '-';

				}

				forn(j, b / 2 + 1) {

					cout << '+';

				}

				cout << endl;

			}

		}


	}

	return 0;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 14 ms 376 KB Output is correct
4 Incorrect 22 ms 504 KB Wrong answer in test 5 29: 31 < 32
# 결과 실행 시간 메모리 Grader output
1 Incorrect 71 ms 1400 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 51 ms 1336 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 14 ms 376 KB Output is correct
4 Incorrect 22 ms 504 KB Wrong answer in test 5 29: 31 < 32