#include "bits/stdc++.h"
using namespace std;
#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int tt;
cin >> tt;
while(tt--) {
int n, m;
cin >> n >> m;
priority_queue<pair<int, int>> pq;
for (int i = 0; i < m; ++i) {
pq.emplace(n, i);
}
int ans = m;
vector<vector<char>> c(n, vector<char> (m, '-'));
int min_col = n - (n - 1) / 2;
for (int i = 0; i < n; ++i) {
int need = m - ((m - 1) / 2);
while (!pq.empty() && need) {
auto [in_col, col] = pq.top();
pq.pop();
if (in_col == min_col) {
break;
}
--need;
in_col--;
c[i][col] = '+';
pq.emplace(in_col, col);
}
ans += !need;
}
cout << ans << '\n';
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
cout << c[i][j];
}
cout << '\n';
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Wrong answer in test 2 1: 1 < 2 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Wrong answer in test 2 1: 1 < 2 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Wrong answer in test 2 1: 1 < 2 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
42 ms |
1284 KB |
Wrong answer in test 97 21: 112 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
44 ms |
1484 KB |
Output is correct |
2 |
Correct |
38 ms |
1468 KB |
Output is correct |
3 |
Correct |
36 ms |
1352 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Wrong answer in test 2 1: 1 < 2 |
3 |
Halted |
0 ms |
0 KB |
- |