Submission #686658

#TimeUsernameProblemLanguageResultExecution timeMemory
686658TheSahibRed-blue table (IZhO19_stones)C++14
27 / 100
34 ms1324 KiB
#include <bits/stdc++.h> #define ll long long #define i128 __int128_t #define pii pair<int, int> #define oo 1e9 using namespace std; void solve(){ int n, m; cin >> n >> m; bool flipped = false; if(m < n){ flipped = true; swap(n, m); } vector<vector<bool>> grid(n, vector<bool>(m, 0)); if(n <= 2){ cout << m << '\n'; } else if(n <= 4){ cout << m + 1 << '\n'; for (int i = 0; i < m; i++) { grid[0][i] = 1; } } else if(n <= 6){ cout << m + 3 << '\n'; for (int i = 0; i < m / 2 + m % 2; i++) { grid[0][i] = 1; } for (int i = m / 2 + m % 2 - 1; i < m; i++) { grid[1][i] = 1; } for (int i = 0; i < m; i++) { grid[2][i] = 1; } grid[2][m / 2 + m % 2 - 1] = 0; } if(!flipped){ for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if(grid[i][j]) cout << '+'; else cout << '-'; } cout << '\n'; } } else{ for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if(!grid[j][i]) cout << '+'; else cout << '-'; } cout << '\n'; } } } int main() { int t; cin >> t; while(t--){ solve(); } }
#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...