# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
519360 | 2022-01-26T09:00:47 Z | shmad | Red-blue table (IZhO19_stones) | C++17 | 3 ms | 588 KB |
#pragma GCC optimize("O3", "unroll-loops") // "Ofast" #pragma GCC target("avx2", "bmi", "bmi2", "lzcnt", "popcnt") #include <bits/stdc++.h> #define int long long #define vt vector #define pb push_back #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() #define ff first #define ss second #define dbg(x) cerr << #x << " = " << x << '\n' using namespace std; using ll = long long; using pii = pair<int, int>; using vvi = vt< vt<int> >; const int N = 1e6 + 5, mod = 1e9 + 7, inf = 1e18 + 7, B = 500, LIM = (1ll << 60); const double eps = 1e-6; void solve () { int n, m; cin >> n >> m; vt< vt<char> > a(n + 1, vt<char> (m + 1, '+')); if (m == 1) { cout << n << '\n'; goto here; } if (n == 1) { cout << m << '\n'; for (int j = 1; j <= m; j++) a[1][j] = '-'; goto here; } if ((n & 1) && (m & 1)) { cout << n - 1 + m - 1 << '\n'; for (int i = 1; i < n; i++) { for (int j = 1; j < m; j++) { if ((i + j) & 1) a[i][j] = '-'; } for (int j = 1; j <= m; j++) a[n][j] = '-'; } goto here; } here: for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) cout << a[i][j] ; cout << '\n'; } cout << '\n'; } bool testcases = 1; signed main() { #ifndef ONLINE_JUDGE freopen(".in", "r", stdin); freopen(".out", "w", stdout); #endif cin.tie(0) -> sync_with_stdio(0); int test = 1; if (testcases) cin >> test; for (int cs = 1; cs <= test; cs++) { solve(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 588 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 588 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 588 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 588 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 588 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 588 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |