Submission #334058

#TimeUsernameProblemLanguageResultExecution timeMemory
334058boykutRed-blue table (IZhO19_stones)C++14
0 / 100
35 ms1388 KiB
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, m, flag = 0;
    cin >> n >> m;
    int a[n][m];
    
    if (n > m) {
      cout << n + m / 2 << '\n';
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++)
          if (j & 1) cout << '-';
          else cout << '+';
        cout << '\n';
      }
    } else {
      cout << m + n / 2 << '\n';
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++)
          if (i & 1) cout << '+';
          else cout << '-';
        cout << '\n';
      }
    }
    
  }
  return 0;
}

Compilation message (stderr)

stones.cpp: In function 'int main()':
stones.cpp:11:15: warning: unused variable 'flag' [-Wunused-variable]
   11 |     int n, m, flag = 0;
      |               ^~~~
stones.cpp:13:9: warning: unused variable 'a' [-Wunused-variable]
   13 |     int a[n][m];
      |         ^
#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...