Submission #681454

# Submission time Handle Problem Language Result Execution time Memory
681454 2023-01-13T06:22:57 Z SnoT Red-blue table (IZhO19_stones) C++14
0 / 100
48 ms 1444 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ull unsigned long long
#define ssort sort(s.begin(),s.end());
#define sreverse reverse(s.begin(),s.end());
#define sclear s.clear();
#define ssize s.size();
#define ld long double
#define F first
#define S second
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define sq(a) (a)*(a)
ll a,b,c,e,d,f,k,g,h,r,i,j,x,y,z,m,n,l,t,p,s,u,sum,ans,mod=1e18;
ll q[200][200],qr[200][200];
int main(){
	ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>a;
    for(i=1;i<=a;i++)
    {
    	cin>>n>>m;
    	if(n==1&&m==1){
    		cout<<1<<endl<<'+'<<endl; continue;
		}
		////////////////////////////////////////////////////////////////////////////////
		if(n==m){
			l=-1;
		for(j=1;j<=m;j++)
		{
			if(j%2==1) l+=2;
			else l++;
		}
		cout<<l<<endl; l=0;
		if(n%2==1){
			for(j=1;j<=m;j++)
			{
				for(k=1;k<=m;k++)
				{
					if(k%2==1) cout<<'+';
					else cout<<'-';
				}
				cout<<endl;
			}
		}
		else{
			for(j=1;j<=m;j++)
			{
				for(k=1;k<m;k++)
				{
					if(k%2==1) cout<<'+';
					else cout<<'-';
				}
				cout<<'+'<<endl;
			}
		}
		continue;
		}
		////////////////////////////////////////////////////////////////////////////////
		if(m!=n){
			if(m>n){
				k=m+(n)/2;
			if(n%2==0) k--;
			cout<<k<<endl;
				if(n%2==1){
					for(j=1;j<=n;j++)
			{
				for(k=1;k<=m;k++)
				{
					if(j%2==1) cout<<'-';
					else cout<<'+';
				}
				cout<<endl;
			}
				}
				else{
					for(j=1;j<n;j++)
			{
				for(k=1;k<=m;k++)
				{
					if(j%2==1) cout<<'-';
					else cout<<'+';
				}
				cout<<endl;
			}
				}
				if(n>1){
					
				for(k=1;k<=m;k++)
				{
					cout<<'-';
				}
				cout<<endl;
				}
			}
			else{
				k=n+(m)/2;
			    if(m%2==0) k--;
			    cout<<k<<endl;
			    if(m%2==0){
			    	for(j=1;j<=n;j++)
			    	{
			    		for(k=1;k<m;k++)
			    		{
			    			if(k%2==1) cout<<'+';
			    			else cout<<'-';
						}
						cout<<'+'<<endl;
					}
				}
				else{
					for(j=1;j<=n;j++)
			    	{
			    		for(k=1;k<=m;k++)
			    		{
			    			if(k%2==1) cout<<'+';
			    			else cout<<'-';
						}
						cout<<endl;
					}
				}
			}
			
		}
		
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 332 KB Expected integer, but "----" found
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 332 KB Expected integer, but "---------------------------------------------" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 332 KB Expected integer, but "----" found
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 1444 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 1240 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 332 KB Expected integer, but "----" found
3 Halted 0 ms 0 KB -