Submission #171114

#TimeUsernameProblemLanguageResultExecution timeMemory
171114donentsetoRed-blue table (IZhO19_stones)C++14
11 / 100
30 ms1400 KiB
#include <bits/stdc++.h> using namespace std; int main (){ ios::sync_with_stdio (false); cin.tie (0); int t; cin >> t; while (t --){ int n, m; cin >> n >> m; if (n <= 2 && m >= n){ cout << m << '\n'; for (int i = 0; i < n; i ++){ for (int j = 0; j < m; j ++) cout << '-'; cout << '\n'; } } else if (m <= 2){ cout << n << '\n'; for (int i = 0; i < n; i ++){ for (int j = 0; j < m; j ++) cout << '+'; cout << '\n'; } } else{ cout << n - 2 + n % 2 + m - 2 + m % 2 << '\n'; for (int i = 0; i < n; i ++){ for (int j = 0; j < m; j ++){ if (i <= n >> 1 && j < m - 1 >> 1) cout << '-'; else if (i >= n - 1 >> 1 && j > m >> 1) cout << '-'; else cout << '+'; } cout << '\n'; } } } }

Compilation message (stderr)

stones.cpp: In function 'int main()':
stones.cpp:31:46: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
                     if (i <= n >> 1 && j < m - 1 >> 1) cout << '-';
                                            ~~^~~
stones.cpp:32:37: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
                     else if (i >= n - 1 >> 1 && j > m >> 1) cout << '-';
                                   ~~^~~
#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...