제출 #1156277

#제출 시각아이디문제언어결과실행 시간메모리
1156277KaleemRazaSyedRed-blue table (IZhO19_stones)C++20
0 / 100
35 ms1352 KiB
#include<bits/stdc++.h>

using namespace std;

void solve()
{
  int n, m;
  cin >> n >> m;
  bool ans[n][m];
  int sz = max(m + (n + 1) / 2, n + (m + 1) / 2);
  int t = (m + (n + 1) / 2 >= n + (m + 1) / 2);
  
  
  memset(ans, false, sizeof(ans));
  if(t == 1)
    {
      for(int j = 0; j < m; j ++)
	for(int i = 0; i < n / 2; i++)
	  ans[(j % 2 ? i : n - i - 1)][j] = 1;
    }
  else
    {
      for(int i = 0; i < n; i ++)
	for(int j = 0; j < m / 2 + 1; j++)
	  ans[i][(i % 2 ? j : m - j - 1)] = 1;
    }
  
  cout << sz << endl;
  for(int i = 0; i < n; i ++)
    {
      for(int j = 0; j < m; j ++)
	cout << (ans[i][j] ? '+' : '-');
      cout << endl;
    }
}

int main()
{
  int t;
  cin >> t;
  while(t--)
    solve();
  return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...