제출 #1197022

#제출 시각아이디문제언어결과실행 시간메모리
1197022bleahbleahRed-blue table (IZhO19_stones)C++20
0 / 100
14 ms1352 KiB
#include <bits/stdc++.h> #define all(x) (x).begin(),(x).end() using namespace std; using ll = long long; using ld = long double; //#define int ll #define sz(x) ((int)(x).size()) using pii = pair<int,int>; using tii = tuple<int,int,int>; void testcase() { int n, m; cin >> n >> m; if(n <= 1) { cout << max(n, m) << '\n'; for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) cout << "-\n"[j == m]; return; } if(m <= 1) { cout << max(n, m) << '\n'; for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) cout << "+\n"[j == m]; return; } if(n <= 2) { cout << max(n, m) << '\n'; for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) cout << "-\n"[j == m]; return; } if(m <= 2) { cout << max(n, m) << '\n'; for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) cout << "+\n"[j == m]; return; } int ln = n - 1, lm = m - 1; ln -= ln % 2; lm -= lm % 2; cout << ln + lm << '\n'; for(int i = 1; i <= n; i++) { for(int j = 1; j <= m; j++) { if(i <= ln && j <= lm) cout << ((i + j) % 2? '+' : '-'); else if(i > ln) cout << '-'; else cout << '+'; } cout << '\n'; } } signed main() { cin.tie(0) -> sync_with_stdio(0); int T; cin >> T; while(T--) testcase(); } /** Binecuvanteaza Doamne Ukraina. -- */
#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...