Submission #1102140

#TimeUsernameProblemLanguageResultExecution timeMemory
1102140rembocoderRed-blue table (IZhO19_stones)C++17
100 / 100
8 ms3368 KiB
#include <bits/stdc++.h> using namespace std; #define int int64_t const int mod = 1e9 + 7; const int inf = 2e18; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int ttt; cin >> ttt; while (ttt--) { int n, m; cin >> n >> m; bool inv = false; if (n > m) { inv = true; swap(n, m); } vector<string> a(n, string(m, '-')); int plus_in_col = (n - 1) / 2; int pos_rows = (plus_in_col * m) / (m / 2 + 1); int i = 0; for (int j = 0; j < m; j++) { for (int q = 0; q < plus_in_col; q++) { a[i][j] = '+'; i = (i + 1) % pos_rows; } } cout << pos_rows + m << '\n'; if (inv) { swap(n, m); vector<string> b(n, string(m, '-')); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { b[i][j] = a[j][i] == '-' ? '+' : '-'; } } a = b; } for (int i = 0; i < n; i++) { cout << a[i] << '\n'; } } }
#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...