제출 #209912

#제출 시각아이디문제언어결과실행 시간메모리
209912super_j6Red-blue table (IZhO19_stones)C++14
27 / 100
32 ms1400 KiB
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; #define endl '\n' #define pi pair<int, int> int n, m; void answer(){ cin >> n >> m; int t; if(n < m){ t = (n - 1) / 2; cout << (m + t) << endl; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ cout << (i < t ? '+' : '-'); } cout << endl; } }else if(n > m || (n == m && n <= 4)){ t = (m - 1) / 2; cout << (n + t) << endl; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ cout << (j < t ? '-' : '+'); } cout << endl; } }else{ t = (n - 1) / 2; cout << (4 * t) << endl; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ if(i < t && j < m - t) cout << '+'; else if(i > n - t - 1 && j > t - 1) cout << '+'; else cout << '-'; } cout << endl; } } } int main(){ ios::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; for(int i = 0; i < t; i++) answer(); 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...