제출 #893272

#제출 시각아이디문제언어결과실행 시간메모리
893272maxFedorchukRed-blue table (IZhO19_stones)C++14
100 / 100
21 ms2396 KiB
#include <bits/stdc++.h> using namespace std; void fun() { long long n,m; cin>>n>>m; bool swp=0; if(m>n) { swap(n,m); swp=1; } char ch[n+5][m+5]; for(long long i=1;i<=n;i++) { for(long long j=1;j<=m;j++) { ch[i][j]='+'; } } long long mx_can_in_row=(m-1)/2; long long mn_ned_st=n/2+1; long long zarc=0,st=1,ans=n; for(long long i=0;i<mx_can_in_row;i++) { for(long long j=1;(j<=n && st<=m);j++) { ch[j][st]='-'; zarc++; if(zarc>=mn_ned_st) { st++; zarc=0; ans++; } } } cout<<ans<<"\n"; if(swp) { for(long long j=1;j<=m;j++) { for(long long i=1;i<=n;i++) { if(ch[i][j]=='+') { cout<<"-"; } else { cout<<"+"; } } cout<<"\n"; } } else { for(long long i=1;i<=n;i++) { for(long long j=1;j<=m;j++) { cout<<ch[i][j]; } cout<<"\n"; } } return; } int main() { cin.tie(0); ios_base::sync_with_stdio(0); long long t; cin>>t; while(t--) { fun(); } 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...