답안 #681458

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
681458 2023-01-13T06:25:51 Z SnoT Red-blue table (IZhO19_stones) C++14
27 / 100
43 ms 1236 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%2==0){
					
				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;
					}
				}
			}
			
		}
		
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Incorrect 9 ms 328 KB Wrong answer in test 5 29: 31 < 32
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 43 ms 1236 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 36 ms 1196 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Incorrect 9 ms 328 KB Wrong answer in test 5 29: 31 < 32
5 Halted 0 ms 0 KB -