답안 #681757

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
681757 2023-01-14T07:08:05 Z SnoT Red-blue table (IZhO19_stones) C++14
100 / 100
43 ms 3164 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)
/*void fopn(string name){
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}*/
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;
char arr[2000][2000];
int main(){
	ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>a;
    for(i=1;i<=a;i++)
    {
    	r=0;
    	cin>>n>>m;
    	if(n==1&&m==1){
    		cout<<1<<endl<<'+'<<endl; continue;
		}
		if(n>m){
			swap(n,m); r=1; //swapped
			
	}
	    for(j=1;j<=n;j++){
		    for(k=1;k<=m;k++){
			    if(r) arr[j][k]='+';
			    else arr[j][k]='-';
		}
	}
	l=min(n,(n/2-!(n%2))*m/(m/2+1));
	cout<<m+l<<endl; 
	for(j=1,h=1;j<= l ;j++){
		for(k=1;k<=m/2+1;k++,h++)
		{
			if(h>m) h=1;
			if(r) arr[j][h]='-';
			else  arr[j][h]='+';

		}
	}
	if(!r){
		
	for(j=1;j<=n;j++)
	{
		for(k=1;k<=m;k++)
		{
			cout<<arr[j][k];
		}
		cout<<endl;
	}
	}
	else{
	
	for(j=1;j<=m;j++)
	{
		for(k=1;k<=n;k++)
		{
			cout<<arr[k][j];
		}
		cout<<endl;
	}
}
}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 6 ms 340 KB Output is correct
4 Correct 10 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 1528 KB Output is correct
2 Correct 21 ms 2612 KB Output is correct
3 Correct 25 ms 2576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 1600 KB Output is correct
2 Correct 19 ms 2448 KB Output is correct
3 Correct 18 ms 2132 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 6 ms 340 KB Output is correct
4 Correct 10 ms 340 KB Output is correct
5 Correct 43 ms 1528 KB Output is correct
6 Correct 21 ms 2612 KB Output is correct
7 Correct 25 ms 2576 KB Output is correct
8 Correct 32 ms 1600 KB Output is correct
9 Correct 19 ms 2448 KB Output is correct
10 Correct 18 ms 2132 KB Output is correct
11 Correct 26 ms 568 KB Output is correct
12 Correct 19 ms 2160 KB Output is correct
13 Correct 29 ms 2120 KB Output is correct
14 Correct 17 ms 1684 KB Output is correct
15 Correct 23 ms 3164 KB Output is correct
16 Correct 18 ms 2508 KB Output is correct
17 Correct 8 ms 1492 KB Output is correct