Submission #474951

#TimeUsernameProblemLanguageResultExecution timeMemory
474951fuad27Red-blue table (IZhO19_stones)C++17
0 / 100
100 ms2244 KiB
#include<bits/stdc++.h> using namespace std; int main () { int t; cin >> t; while(t--) { char red = '+', blue = '-'; int n, m; bool swapped = false; cin >> n >> m; if(n < m) { swap(n, m); swap(red, blue); swapped = true; } char table[n][m]; for(int i = 0;i<n;i++) { for(int j = 0;j<m;j++)table[i][j] = red; } int cnt = 0, ans = n; for(int asdf = 0;asdf<(m-1)/2;asdf++) { for(int i = 0;i<n;i++) { table[i][ans-n]=blue; cnt++; if(cnt == (n/2) + 1) { ans++; cnt = 0; } } } cout<<ans<<endl; if(!swapped) { for(int i = 0;i<n;i++) { for(int j = 0;j<m;j++) { cout<<table[i][j]<<' '; } cout<<endl; } } else { for(int i = 0;i<m;i++) { for(int j = 0;j<n;j++) { cout<<table[j][i]; } cout<<endl; } } } }
#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...