Submission #236450

# Submission time Handle Problem Language Result Execution time Memory
236450 2020-06-02T10:08:23 Z kshitij_sodani Intergalactic ship (IZhO19_xorsum) C++17
0 / 100
16 ms 512 KB
#include <bits/stdc++.h>
using namespace std;
typedef int64_t llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
int n,m,t;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>t;
	while(t--){
		cin>>n>>m;
		if(n==1){
			cout<<m<<endl;
			for(int j=0;j<m;j++){
				cout<<"-";
			}
			cout<<endl;
		}
		else if(m==1){
			cout<<n<<endl;
			for(int j=0;j<n;j++){
				cout<<"+"<<endl;
			}
			cout<<endl;
		}
		else if(n==2){
			cout<<m<<endl;
			for(int i=0;i<m;i++){
				cout<<"-";
			}
			cout<<endl;
			for(int i=0;i<m;i++){
				cout<<"-";
			}
			cout<<endl;
		}
		else if(m==2){
			cout<<n<<endl;
			for(int i=0;i<n;i++){
				cout<<"++"<<endl;
			}
		}
		else if(n==3){
			cout<<(m+1)<<endl;
			for(int i=0;i<m;i++){
				cout<<"-";
			}
			cout<<endl;
			for(int i=0;i<m;i++){
				cout<<"+";
			}
			cout<<endl;
			for(int i=0;i<m;i++){
				cout<<"-";
			}
			cout<<endl;
		}
		else if(m==3){
			cout<<(n+1)<<endl;
			for(int i=0;i<n;i++){
				cout<<"+-+"<<endl;
			}
		}
		else if(n==4){
			cout<<m<<endl;
			for(int j=0;j<4;j++){
				for(int i=0;i<m;i++){
					cout<<"-";
				}
				cout<<endl;
			}
		}
		else if(m==4){
			cout<<n<<endl;
			for(int i=0;i<n;i++){
				cout<<"++++"<<endl;
			}
		}
		else if(n==5){
			cout<<(m+2)<<endl;
			for(int i=0;i<m;i++){
				cout<<"-";
			}
			cout<<endl;
			for(int i=0;i<m;i++){
				cout<<"+";
			}
			cout<<endl;
			for(int i=0;i<m;i++){
				cout<<"-";
			}
			cout<<endl;
			for(int i=0;i<m;i++){
				cout<<"+";
			}
			cout<<endl;
			for(int i=0;i<m;i++){
				cout<<"-";
			}
			cout<<endl;
		}
		else if(m==5){
			cout<<(n+2)<<endl;
			for(int i=0;i<n;i++){
				cout<<"+-+-+"<<endl;
			}
		}

		/*int it[n][m];
			if(n>m){
				int l=0;
				for(int i=0;i<n;i++){
					for(int j=l;j<l+(m+2)/2;j++){
						it[i][j%m]=1;
					}
					l=l+(m+2)/2;
					l%=m;
				}
				for(int i=0;i<n;i++){
					for(int j=0;j<m;j++){
						if(it[i][j]){
							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;
				}
			}*/
		
	}


	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -