Submission #769759

#TimeUsernameProblemLanguageResultExecution timeMemory
769759TrunktyRed-blue table (IZhO19_stones)C++14
15 / 100
22 ms1840 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll int t; char arr[1005][1005]; signed main(){ ios::sync_with_stdio(false); cin.tie(NULL); cin >> t; for(int e=1;e<=t;e++){ int n,m,ans; cin >> n >> m; if(n>=m){ int rem = m-m/2-1, need = n-(n-n/2-1); for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ arr[i][j] = '+'; } } int curr=1,cnt=0; for(int c=0;c<rem*n;c++){ if(cnt==need){ cnt = 0; curr++; } arr[c%n+1][curr] = '-'; cnt++; } if(cnt==need){ cnt = 0; curr++; } ans = n+curr-1LL; } else{ int rem = n-n/2-1, need = m-(m-m/2-1); for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ arr[i][j] = '-'; } } int curr=1,cnt=0; for(int c=0;c<rem*m;c++){ if(cnt==need){ cnt = 0; curr++; } arr[curr][c%m+1] = '-'; cnt++; } if(cnt==need){ cnt = 0; curr++; } ans = m+curr-1LL; } cout << ans << "\n"; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cout << arr[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...