Submission #1156246

#TimeUsernameProblemLanguageResultExecution timeMemory
1156246KaleemRazaSyedRed-blue table (IZhO19_stones)C++20
27 / 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 = m, A = 0;

  for(int x = 1; x <= n; x++) // how much does I will get if my A = x
    {
      int g = x;
      if(x <= n - (n / 2 + 1))
	g += m;
      else
	g += m - (m/2 + 1);

      // cerr << x << ' ' << g << endl; 
      if(g > sz)
	sz = g, A = x;
    }
  
  memset(ans, false, sizeof(ans));
  for(int i = 0; i < A; i ++)
    for(int j = 0; j < m / 2 + 1; j++)
      ans[i][j] = 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...