제출 #334356

#제출 시각아이디문제언어결과실행 시간메모리
334356boykutRed-blue table (IZhO19_stones)C++14
100 / 100
36 ms2284 KiB
#include <bits/stdc++.h>

using namespace std;

char a[1000][1000];

void solve() {
  int n, m, flag = 0;
  cin >> n >> m;
  if (n < m) {
    swap(n, m);
    flag = 1;
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      a[i][j] = '+';
  int J = 0, cnt = n / 2 + 1;
  for (int j = 0; j < (m - 1) / 2; j++) {
    for (int i = 0; i < n; i++) {
      a[i][J] = '-';
      cnt--;
      if (cnt == 0) {
        J++;
        cnt = n / 2 + 1;
      }
    }
  }
  cout << n + J << '\n';
  if (flag) swap(n, m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (flag) cout << char('+'+'-'-a[j][i]);
      else cout << a[i][j];
    }
    cout << '\n';
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  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...