Submission #892240

#TimeUsernameProblemLanguageResultExecution timeMemory
892240dilshod9890Red-blue table (IZhO19_stones)C++17
27 / 100
18 ms1372 KiB
#include <bits/stdc++.h> #include <algorithm> #include <map> using namespace std; using ll = long long; #define gcd __gcd void solve() { ll a,b; cin >> a >> b; if (a>=b){ if (b%2==0){ cout << a+(b/2)-1; cout << "\n"; for (int i = 0; i < a; i++){ for (int i = 0; i < b-(b/2)+1; i++){ cout << '+'; } for (int i = 0; i < (b/2)-1; i++){ cout << '-'; } cout << "\n"; } return; } cout << a+(b/2); cout << "\n"; for (int i = 0; i < a; i++){ for (int i = 0; i < b-(b/2); i++){ cout << '+'; } for (int i = 0; i < (b/2); i++){ cout << '-'; } cout << "\n"; } }else if (a<b){ if (a%2==0){ cout << b+(a/2)-1; cout << "\n"; for (int i = 0; i < a-(a/2)+1; i++){ for (int i = 0; i < b; i++){ cout << '-'; } cout << "\n"; } for (int i = 0; i < (a/2)-1; i++){ for (int i = 0; i < b; i++)cout << '+'; cout << "\n"; } return; } cout << b+(a/2); cout << "\n"; for (int i = 0; i < a-(a/2); i++){ for (int i = 0; i < b; i++){ cout << '-'; } cout << "\n"; } for (int i = 0; i < (a/2); i++){ for (int i = 0; i < b; i++)cout << '+'; cout << "\n"; } } } int main() { cin.tie(0)->sync_with_stdio(false); #ifdef null freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int q = 1; cin >> q; while (q--) { 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...