Submission #993333

#TimeUsernameProblemLanguageResultExecution timeMemory
993333simona1230Red-blue table (IZhO19_stones)C++17
100 / 100
38 ms2392 KiB
#include <bits/stdc++.h> using namespace std; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } char c[1024][1024]; int cnt[1024]; void read() { memset(cnt,0,sizeof(cnt)); int n,m; cin>>n>>m; bool s=0; if(m<n)s=1,swap(n,m); for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { c[i][j]='-'; } } int j=1; int ans=m; for(int i=1;i<=n;i++) { int curr=m/2+1; while(curr) { if(cnt[j]==n-n/2-1)break; cnt[j]++; c[i][j]='+'; curr--; j++; if(j==m+1)j=1; } if(curr)break; ans++; } cout<<ans<<endl; if(s) { for(int j=1; j<=m; j++) { for(int i=1; i<=n; i++) { if(c[i][j]=='-')cout<<"+"; else cout<<"-"; } cout<<endl; } } else { for(int i=1; i<=n; i++) { for(int j=1; j<=m; j++) { cout<<c[i][j]; } cout<<endl; } } } int main() { speed(); int t; cin>>t; while(t--) read(); 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...