답안 #384226

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
384226 2021-03-31T19:55:18 Z ritul_kr_singh Red-blue table (IZhO19_stones) C++17
28 / 100
33 ms 1388 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sp << ' ' << 
#define nl << '\n'

bool e(int y){ return !(y%2); } // lol 

signed main(){
	cin.tie(0)->sync_with_stdio(0);
	int T; cin >> T;
	while(T--){
		int n, m; cin >> n >> m;
		if(e(m) and ((e(n) and m > n) or !e(n))){
			cout << m + max(0LL, (n-1)/2) nl;
			for(int i=0; i<n; ++i){
				for(int j=0; j<m; ++j){
					cout << (i+i > n ? '+' : '-');
				}cout nl;
			}
		}else if(e(n)){
			cout << n + max(0LL, (m-1)/2) nl;
			for(int i=0; i<n; ++i){
				for(int j=0; j<m; ++j){
					cout << (j+j > m ? '-' : '+');
				}cout nl;
			}
		}else if(n==1){
			cout << m nl;
			for(int i=0; i<m; ++i) cout << '-';
			cout nl;
		}else if(m==1){
			cout << n nl;
			for(int i=0; i<n; ++i) cout << '+' nl;
		}else{
			cout << n + m - 2 nl;
			for(int i=0; i<n; ++i){
				for(int j=0; j<m; ++j){
					if(i and j) cout << ((i+j) % 2 ? '+' : '-');
					else cout << (i ? '+' : '-');
				}
				cout nl;
			}
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 364 KB Wrong answer in test 5 2: 4 < 5
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 2 ms 364 KB Wrong answer in test 5 2: 4 < 5
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1388 KB Output is correct
2 Correct 29 ms 1260 KB Output is correct
3 Correct 28 ms 1260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 32 ms 1388 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 Incorrect 2 ms 364 KB Wrong answer in test 5 2: 4 < 5