답안 #380046

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
380046 2021-03-20T07:54:06 Z Kalashnikov Red-blue table (IZhO19_stones) C++17
27 / 100
35 ms 1516 KB
#include <bits/stdc++.h>
 
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
#define all(a) a.begin() , a.end()
#define F first
#define S second
 
using namespace std;
using ll = long long;
 
const int N = 500+5 , inf = 2e9 + 7;
const ll INF = 1e18 ,   mod = 1e9+7 , P = 6547;
 
void solve() {
	int n , m;
	cin >> n >> m;
	cout << max(n , m) + (min(n , m)+1)/2-1 << '\n';
	for(int i = 1; i <= n; i ++) {
		for(int j = 1; j <= m; j ++) {
			if(n >= m) {
				if(j <= m/2+1) {
					cout << '+';
				}
				else {
					cout << '-';
				}
			}
			else {
				if(i <= n/2+1) {
					cout << '-';
				}
				else {
					cout << '+';
				}
			}
		}
		cout << '\n';
	}
//	cout << '\n';
}
/*
1 2 1 2   2
 
 
*/
main() {
    ios;
    int tt = 1;
    cin >> tt;
    while(tt --) {
        solve();
    }
    return 0;
}

Compilation message

stones.cpp:47:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   47 | main() {
      |      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 2 ms 364 KB Wrong answer in test 5 29: 31 < 32
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 1516 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 34 ms 1340 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 2 ms 364 KB Wrong answer in test 5 29: 31 < 32