Submission #499978

#TimeUsernameProblemLanguageResultExecution timeMemory
499978yahyobekabdunazarovRed-blue table (IZhO19_stones)C++17
32 / 100
25 ms1588 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; void solve(){ int n, m; cin >> n >> m; bool swaped=false; if(n<m){ swap(n, m); swaped=true; } char a[n][m]; for(int i=0; i<n; i++){ for(int j=0; j<m; j++){ a[i][j]='+'; } } int x = 0, ans=n, y=0; for(int i=0; i<(m-1)/2; i++){ for(int j=0; j<m; j++){ a[j][y]='-'; x++; if(x==(n/2)+1){ ans++; y++; x=0; } } } cout << ans << "\n"; if(!swaped){ for(int i=0; i<n; i++){ for(int j=0; j<m; j++){ cout << a[i][j]; } cout << "\n"; } } else{ for(int i=0; i<m; i++){ for(int j=0; j<n; j++){ if(a[j][i]=='+'){ cout << '-'; } else{ cout << '+'; } } cout << "\n"; } } } int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while(t--){ solve(); } 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...