답안 #167951

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
167951 2019-12-11T02:18:52 Z YottaByte Red-blue table (IZhO19_stones) C++14
27 / 100
44 ms 1400 KB
#include <iostream>

using namespace std;

#define ll long long
#define sz(x) (int)x.size()
#define pii pair < int, int >
#define endl "\n"
#define METH ios::sync_with_stdio(0); cin.tie(0);
#define BEGIN cout << "BEGIN" << endl;
#define END cout << "END" << endl;

const int mod = 1e9 + 7;										/// ANOTHER HASH MOD: 228228227
const int prime = 29;											/// ANOTHER HASH PRIME: 997
const int INF = ((long long) 0xCAFEBABE - 1e9 - 4e8);

int n, m;

inline void purify() {
}

inline void precalc() {
}

inline void read() {
	scanf("%d %d", &n, &m);
}

inline void solve() {
	if ((n - 1) / 2 + m >= (m - 1) / 2 + n) {
		cout << (n - 1) / 2 + m << endl;
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= m; j++) {
				if (i <= (n - 1) / 2) {
					if (j <= m / 2 + 1) {
						cout << '+';
						continue;
					}
				}
				cout << '-';
			}
			cout << endl;
		}
	} else {
		cout << (m - 1) / 2 + n << endl;
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= m; j++) {
				if (i <= n / 2 + 1) {
					if (j <= (m - 1) / 2) {
						cout << '-';
						continue;
					}
				}
				cout << '+';
			}
			cout << endl;
		}
	}
}

int main() {
	int t;
	scanf("%d", &t);

	//precalc();
	while (t--) {
		//purify();
		read();
		solve();
	}
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:63:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &t);
  ~~~~~^~~~~~~~~~
stones.cpp: In function 'void read()':
stones.cpp:26:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Incorrect 4 ms 376 KB Wrong answer in test 5 29: 31 < 32
# 결과 실행 시간 메모리 Grader output
1 Incorrect 44 ms 1400 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 43 ms 1272 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Incorrect 4 ms 376 KB Wrong answer in test 5 29: 31 < 32