Submission #1222139

#TimeUsernameProblemLanguageResultExecution timeMemory
1222139thangdz2k7Red-blue table (IZhO19_stones)C++20
100 / 100
49 ms3396 KiB
#include <bits/stdc++.h> using namespace std; void process(){ int n, m; cin >> n >> m; int swapped = 0; if (n < m){ swap(n, m); swapped = 1; } vector <string> s(n); for (int i = 0; i < n; ++ i) for (int j = 0; j < m; ++ j) s[i] = s[i] + '+'; int res = n, x = 0, c = 0; for (int loops = 0; loops < (m - 1) / 2; ++ loops){ for (int i = 0; i < n; ++ i){ s[i][x] = '-'; c ++; if (c > n / 2){ c = 0, x ++, res ++; } } } cout << res << "\n"; if (!swapped){ for (int i = 0; i < n; ++ i) cout << s[i] << "\n"; return; } for (int j = 0; j < m; ++ j){ for (int i = 0; i < n; ++ i) if (s[i][j] == '+') cout << '-'; else cout << '+'; cout << "\n"; } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while (t --) process(); 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...