제출 #488662

#제출 시각아이디문제언어결과실행 시간메모리
488662Mihai7218Red-blue table (IZhO19_stones)C++14
38 / 100
32 ms1236 KiB
#include <iostream> using namespace std; int t, n, m, mop, nop; int main() { cin >> t; for (int tc = 1; tc <= t; tc++) { cin >> n >> m; if (n > m) { cout << max(n+ (m/2)-1+(m%2), (m+n-4+m%2+n%2)) << '\n'; if (n+ (m/2)-1+(m%2) >= (m+n-4+m%2+n%2)) { mop = (m/2)-1+(m%2); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (mop-j >= 0) { cout << '-'; } else cout << '+'; } cout << '\n'; } } else { mop = n-2+n%2; nop = m-2+m%2; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (mop - i >= 0) { if (i % 2 == 0) { if ((m/2+1) - j >= 0) { cout << '+'; } else cout << '-'; } if (i % 2 == 1) { if (j - (m/2+1) + (1-m%2) >= 0) { cout << '+'; } else cout << '-'; } } else cout << '-'; } cout << '\n'; } } } else { cout << max(m + (n/2)-1+(n%2), (m+n-4+m%2+n%2)) << '\n'; if ( m + (n/2)-1+(n%2) >= (m+n-4+m%2+n%2)) { mop = (n/2)-1+(n%2); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (mop-i >= 0) { cout << '+'; } else cout << '-'; } cout << '\n'; } } else { mop = n-2+n%2; nop = m-2+m%2; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (mop - i >= 0) { if (i % 2 == 0) { if ((m/2+1) - j >= 0) { cout << '+'; } else cout << '-'; } if (i % 2 == 1) { if (j - (m/2+1) + (1-m%2) >= 0) { cout << '+'; } else cout << '-'; } } else cout << '-'; } cout << '\n'; } } } } 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...