Submission #683681

#TimeUsernameProblemLanguageResultExecution timeMemory
683681TemkabatRed-blue table (IZhO19_stones)C++14
0 / 100
46 ms1256 KiB
#include <iostream> using namespace std; int main() { int T; cin>>T; for (int i = 0; i < T; i++){ int N, M; bool rotated=false; cin>>N>>M; if(N>M){ int t; t=N; N=M; M=t; rotated=true; } char table[N][M]; int a=M/2+1, b; int c=N/2; int d=N%2; if(N==1 and M==1){ cout<<"1\n+\n"; }else{ b=min( N, (c - !(d)) * M / a ); cout<<M+b<<"\n"; for(int k=0;k<N;k++){ for(int l=0;l<M;l++){ if(rotated==true){ table[k][l]='+'; } else{ table[k][l]='-'; } } } for(int k=0, l=0; k<b; k++){ for(int n=0; n<a; n++,l++){ if(l>M){ l=1; } if(rotated==true){ table[k][l]='-'; } else{ table[k][l]='+'; } } } for(int k=0;k<N;k++){ for(int l=0;l<M;l++){ if(rotated==false){ cout<<table[k][l]; } else{ cout<<table[l][k]; } } 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...