Submission #919536

#TimeUsernameProblemLanguageResultExecution timeMemory
919536AnarTzRed-blue table (IZhO19_stones)C++17
100 / 100
24 ms2392 KiB
#include <iostream> #include <vector> #include <algorithm> #include <cstring> using namespace std; int main() { long long t; cin >> t; while (t--) { int ans,n,m,maxl,addl,needed,check,q,w,plus=0; ans = 0; cin >> n >> m; char table[n][m]; bool bosoo; if (n>=m) { maxl = n; addl = ((m-(m/2+1))*n)/(n/2+1); bosoo = true; memset(table,'+',sizeof table); needed = n/2+1; }else{ maxl = m; addl = ((n-(n/2+1))*m)/(m/2+1); bosoo = false; memset(table,'-',sizeof table); needed = m/2+1; } ans = maxl + addl; cout << ans<<endl; check = needed*addl; q=0; w=0; while (check>0 && bosoo == false) { table[q][w]='+'; w++; check--; plus++; if (plus==maxl/2+1) { q++; plus=0; } if (w==maxl) { w=0; } } while (check>0 && bosoo == true) { table[w][q]='-'; w++; check--; plus++; if (plus==maxl/2+1) { q++; plus=0; } if (w==maxl) { w=0; } } for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { cout << table[i][j]; } cout << '\n'; } } 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...