Submission #202868

#TimeUsernameProblemLanguageResultExecution timeMemory
202868luciocfRed-blue table (IZhO19_stones)C++14
27 / 100
63 ms1528 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3+10; char tab[maxn][maxn]; int main(void) { int t; scanf("%d", &t); while (t--) { int n, m; scanf("%d %d", &n, &m); int mx = 0, ind = 1; for (int A = 0; A <= n; A++) { int qtd = (m+2)/2; int B = m-qtd; if (n-A >= (n+2)/2) B = m; if (A+B > mx) mx = A+B, ind = A; } for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (i <= ind && j <= (m+2)/2) tab[i][j] = '+'; else tab[i][j] = '-'; } } printf("%d\n", mx); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) printf("%c", tab[i][j]); printf("\n"); } } }

Compilation message (stderr)

stones.cpp: In function 'int main()':
stones.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &t);
  ~~~~~^~~~~~~~~~
stones.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &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...