Submission #218315

#TimeUsernameProblemLanguageResultExecution timeMemory
218315LawlietRed-blue table (IZhO19_stones)C++17
27 / 100
53 ms1528 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 1010; int n, m; char ans[MAXN][MAXN]; char aux[MAXN][MAXN]; int main() { int t; scanf("%d",&t); for(int k = 0 ; k < t ; k++) { scanf("%d %d",&n,&m); bool wasSwaped = false; if( n > m ) { swap( n , m ); wasSwaped = true; } printf("%d\n",n + m - (n + 2)/2); for(int i = 1 ; i <= n - (n + 2)/2 ; i++) for(int j = 1 ; j <= m ; j++) ans[i][j] = '+'; for(int i = n - (n + 2)/2 + 1 ; i <= n ; i++) for(int j = 1 ; j <= m ; j++) ans[i][j] = '-'; if( wasSwaped ) { for(int i = 1 ; i <= n ; i++) for(int j = 1 ; j <= m ; j++) aux[i][j] = ans[i][j]; for(int i = 1 ; i <= m ; i++) for(int j = 1 ; j <= n ; j++) ans[i][j] = '+' + '-' - aux[j][i]; swap( n , m ); } for(int i = 1 ; i <= n ; i++, printf("\n")) for(int j = 1 ; j <= m ; j++) printf("%c",ans[i][j]); } }

Compilation message (stderr)

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