제출 #1156266

#제출 시각아이디문제언어결과실행 시간메모리
1156266KaleemRazaSyedRed-blue table (IZhO19_stones)C++20
38 / 100
35 ms1864 KiB
#include<bits/stdc++.h> using namespace std; void solve() { int n, m; cin >> n >> m; bool ans[n][m]; int A = n - (n/2 + 1), sz = m + A, T = 0; for(int i = A + 1; i <= n; i++) { int g = i, t = 0; g += ((m + 1) / 2 - 1); // case for t = 0 // now for t = 1 int g2 = i; if(i / 2 <= (n + 1) / 2 - 1) { if(m % 2 == 0) g2 += m / 2 -1; else g2 += m / 2; } if((i + 1) / 2 <= (n + 1) / 2 - 1) { if(m % 2 == 0) g2 += m / 2 - 1; else g2 += m / 2; } t = (g <= g2); g = max(g, g2); if(g > sz) sz = g, A = i, T = t; } memset(ans, false, sizeof(ans)); for(int i = 0; i < A; i ++) { if(i % 2 == 0 && T) for(int j = 0; j < m / 2 + 1; j++) ans[i][j] = 1; else for(int j = 0; j < m / 2 + 1; j++) ans[i][m - j - 1] = 1; } cout << sz << endl; for(int i = 0; i < n; i ++) { for(int j = 0; j < m; j ++) cout << (ans[i][j] ? '+' : '-'); cout << endl; } } int main() { int t; cin >> t; while(t--) solve(); 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...