답안 #514025

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
514025 2022-01-18T02:28:25 Z Aktan Red-blue table (IZhO19_stones) C++17
0 / 100
54 ms 1280 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;
    	if(max(n,m)%2!=0){
    		cout << max(n,m)+(min(n,m)/2) << endl;
    		if(max(n,m)==n){
    			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(i%2==0){
    					cout << "-";
					}
					else{
						cout << "+";
					}
				}
				cout << endl;
			}
			}	
		}
		else{
			cout << max(n,m)+(max((min(n,m)/2)-1,(int)0)) << endl;
			if(max(n,m)==n){
    			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(i%2==0){
    					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 0 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 204 KB in the table A+B is not equal to 20
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 54 ms 1208 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 39 ms 1280 KB in the table A+B is not equal to 35
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB in the table A+B is not equal to 4