답안 #514044

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
514044 2022-01-18T02:40:00 Z Aktan Red-blue table (IZhO19_stones) C++17
0 / 100
51 ms 1272 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;
			if(max(n,m)==n && 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 if(max(n,m)==n && m%2==0){
				for(int i=0;i<n;i++){
    			for(int j=0;j<m;j++){
    				if(j%2==0){
    					cout << "+";
					}
					else if(j==1){
						cout << "+";
					}
					else{
						cout << "-";
					}
				}
				cout << endl;
			}
			}
			else if(max(n,m)==m && 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 if(max(n,m)==m && n%2==0){
				for(int i=0;i<n;i++){
    			for(int j=0;j<m;j++){
    				if(i%2==0){
    					cout << "+";
					}
					else if(i==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(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB in the table A+B is not equal to 4
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 304 KB in the table A+B is not equal to 50
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB in the table A+B is not equal to 4
# 결과 실행 시간 메모리 Grader output
1 Incorrect 51 ms 1272 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 39 ms 1168 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB in the table A+B is not equal to 4