제출 #346786

#제출 시각아이디문제언어결과실행 시간메모리
34678612tqianRed-blue table (IZhO19_stones)C++17
0 / 100
45 ms1572 KiB
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; #define f1r(i, a, b) for (int i = a; i < b; i++) #define f0r(i, a) f1r(i, 0, a) #define pb push_back #define eb emplace_back #define f first #define s second #define sz(x) (int) (x).size() typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; typedef vector<pi> vpi; void print(vector<vi> a) { f0r(i, sz(a)) { f0r(j, sz(a[i])) { cout << (a[i][j] ? '+' : '-'); } cout << '\n'; } } void solve_case() { int n, m; cin >> n >> m; int x = ((n + 1) / 2 - 1) * 2; int y = ((m + 1) / 2 - 1) * 2; vector<vi> a(n, vi(m)); if (max(n, m) >= x + y) { if (n > m) { f0r(i, n) { f0r(j, m) { a[i][j] = 1; } } cout << n << '\n'; print(a); return; } else { cout << m << '\n'; print(a); return; } } f0r(i, x) { f0r(j, y) { a[i][j] = ((i+j)%2 ? 1 : 0); } } f1r(i, x, n) { f0r(j, y) { a[i][j] = 1; } } f1r(j, y, m) { f0r(i, n) { a[i][j] = 0; } } cout << x + y << '\n'; print(a); return; } int main() { cin.tie(0)->sync_with_stdio(0); int tt; cin >> tt; while (tt--) { solve_case(); } 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...