Submission #1197021

#TimeUsernameProblemLanguageResultExecution timeMemory
1197021bleahbleahRed-blue table (IZhO19_stones)C++20
0 / 100
14 ms1348 KiB
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;

using ll = long long;
using ld = long double;

//#define int ll
#define sz(x) ((int)(x).size())

using pii = pair<int,int>;
using tii = tuple<int,int,int>;

void testcase() {
   int n, m;
   cin >> n >> m;
   if(n <= 2) {
      for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) cout << "-\n"[j == m];
      return;
   }
   if(n <= m) {
      for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) cout << "+\n"[j == m];
      return;
   }
   int ln = n - 1, lm = m - 1;
   ln -= ln % 2;
   lm -= lm % 2;
   cout << ln + lm << '\n';
   for(int i = 1; i <= n; i++) {
      for(int j = 1; j <= m; j++) {
         if(i <= ln && j <= lm)
            cout << ((i + j) % 2? '+' : '-');
         else if(i > ln) cout << '-';
         else cout << '+';
      }
      cout << '\n';
   }
}


signed main() {
   cin.tie(0) -> sync_with_stdio(0);
   int T;
   cin >> T;
   while(T--) testcase();
   
   
   
}

/**
      Binecuvanteaza Doamne Ukraina.
--
*/ 
#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...