Submission #1306384

#TimeUsernameProblemLanguageResultExecution timeMemory
1306384michael12Red-blue table (IZhO19_stones)C++20
100 / 100
9 ms4428 KiB
#include<bits/stdc++.h> #define ff first #define ss second #define pb push_back #define mp make_pair using namespace std; const int maxn = 5e5; void solve() { int n, m; cin >> n >> m; bool idx = false; if (n < m) { swap(n, m); idx = true; } vector<string> t(n, string(m, '+')); int ans = n; int col = 0, ct = 0; for (int k = 0; k < (m - 1) / 2; k++) { for (int p = 0; p < n; p++) { t[p][col] = '-'; ct++; if (ct == n / 2 + 1) { col++; ct = 0; ans++; } } } cout << ans << '\n'; if (!idx) { for (auto &p : t) { cout << p << '\n'; } } else { for (int j = 0; j < m; j++) { for (int i = 0; i < n; i++) { cout << (t[i][j] == '+' ? '-' : '+'); } cout << '\n'; } } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); 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...