제출 #342313

#제출 시각아이디문제언어결과실행 시간메모리
342313_aniRed-blue table (IZhO19_stones)C++17
0 / 100
45 ms1388 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; char s[1002][1002]; int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; if (min(n, m) > 2) { int ans = n + m - 2; if (n % 2 == 0)ans--; if (m % 2 == 0)ans--; cout << ans << '\n'; int a = n, b = m; if (a % 2)a--; else a -= 2; if (b % 2)b--; else b -= 2; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (i < a / 2 && j < b / 2) cout << '-'; else if (i >= a / 2 && i < a && j >= b / 2 && j < b) cout << '-'; else if (i >= a) cout << '-'; else if (j >= b) cout << '+'; else cout << '+'; } cout << '\n'; } } else { cout << max(m, n) << '\n'; char d; if (m > n) d = '-'; else d = '+'; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) cout << '-'; cout << '\n'; } } } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

stones.cpp: In function 'int main()':
stones.cpp:44:9: warning: variable 'd' set but not used [-Wunused-but-set-variable]
   44 |    char d;
      |         ^
#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...