제출 #1032021

#제출 시각아이디문제언어결과실행 시간메모리
1032021phoenixRed-blue table (IZhO19_stones)C++17
0 / 100
23 ms1372 KiB
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #define cerr cout #else #define cerr if (false) cout #endif void solve() { int n, m; cin >> n >> m; int ra = 0, rb = m; for (int a = 1; a <= n; a++) { int l = 0, r = m + 1; while (r - l > 1) { int b = (l + r) / 2; int k = max(0, m / 2 + 1 - m + b); if ((n - n / 2 - 1) * b >= k * a) l = b; else r = b; } if (a + l > ra + rb) ra = a, rb = l; } cerr << ra << ' ' << rb << '\n'; char arr[n][m]; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) arr[i][j] = '-'; for (int i = 0; i < ra; i++) for (int j = rb; j < m; j++) arr[i][j] = '+'; int k = max(0, m / 2 + 1 - m + rb); int l = 0; for (int i = 0; i < ra; i++) { for (int j = 0; j < k; j++) { arr[i][l] = '+'; l = (l + 1) % rb; } } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) cout << arr[i][j]; cout << '\n'; } } int main() { ios::sync_with_stdio(0); cin.tie(0); int number_of_tests; cin >> number_of_tests; for (int current_test = 0; current_test < number_of_tests; current_test++) { cerr << "++++++++++++ #" << current_test << " ++++++++++++++++\n"; solve(); cerr << "++++++++++++++++++++++++++++++++\n\n"; } }
#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...