답안 #514062

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
514062 2022-01-18T02:56:59 Z Aktan Red-blue table (IZhO19_stones) C++17
27 / 100
53 ms 1300 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
#define ft first
#define sc second
using namespace std;
const int mod=1e9+7,INF=1e17;


main(){
    int t;
    cin >> t;
    while(t--){
    	int n,m;
    	cin >> n >> m;
    	cout << max(n,m)+((min(n,m)-1)/2) << endl;
		int l=max(n,m),r=min(n,m);
		if(l==n){
			if(m%2==1){
				for(int i=0;i<n;i++){
					for(int j=0;j<m;j++){
						if(j%2==0){
							cout << "+";
						}
						else{
							cout << "-";
						}
					}
					cout << endl;
				}
			}
			else{
				for(int i=0;i<n;i++){
					for(int j=0;j<m;j++){
						if(j%2==0){
							cout << "+";
						}
						else if(j==m-1){
							cout << "+";
						}
						else{
							cout << "-";
						}
					}
					cout << endl;
				
			}
		}
	}
	else{
		if(n%2==1){
				for(int i=0;i<n;i++){
					for(int j=0;j<m;j++){
						if(i%2==0){
							cout << "-";
						}
						else{
							cout << "+";
						}
					}
					cout << endl;
				}
			}
			else{
				for(int i=0;i<n;i++){
					for(int j=0;j<m;j++){
						if(i%2==0){
							cout << "-";
						}
						else if(i==n-1){
							cout << "-";
						}
						else{
							cout << "+";
						}
					}
					cout << endl;
				
			}
		}
	}
}
}

Compilation message

stones.cpp:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main(){
      | ^~~~
stones.cpp: In function 'int main()':
stones.cpp:20:18: warning: unused variable 'r' [-Wunused-variable]
   20 |   int l=max(n,m),r=min(n,m);
      |                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 284 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 284 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 6 ms 204 KB Output is correct
4 Incorrect 10 ms 332 KB Wrong answer in test 5 29: 31 < 32
# 결과 실행 시간 메모리 Grader output
1 Incorrect 52 ms 1300 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 53 ms 1168 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 284 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 6 ms 204 KB Output is correct
4 Incorrect 10 ms 332 KB Wrong answer in test 5 29: 31 < 32