Submission #223778

#TimeUsernameProblemLanguageResultExecution timeMemory
223778sochoRed-blue table (IZhO19_stones)C++14
27 / 100
82 ms1348 KiB
#include "bits/stdc++.h" using namespace std; // #define endl '\n' // #define double long double // #define int long long // int MOD = 1000 * 1000 * 1000 + 7; // int MOD = 998244353; void solve() { int x, y; cin >> x >> y; int A = (x - 1) / 2 + y; int B = (y - 1) / 2 + x; int grid[x][y]; if (A > B) { // pick all y columns memset(grid, 0, sizeof grid); int L = (x-1) / 2; for (int i=0; i<L; i++) { for (int j=0; j<y; j++) { grid[i][j] = 1; } } } else { // pick all x rows memset(grid, 1, sizeof grid); int L = (y - 1) / 2; for (int i=0; i<x; i++) { for (int j=0; j<L; j++) { grid[i][j] = 0; } } } cout << max(A, B) << endl; for (int i=0; i<x; i++) { for (int j=0; j<y; j++) { cout << (grid[i][j] ? '+' : '-'); } cout << endl; } } signed main() { int t; cin >> t; while (t--) 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...