QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#690976 | #7943. LIS on Grid | KowerKoint# | WA | 0ms | 3568kb | C++23 | 1.1kb | 2024-10-31 09:12:03 | 2024-10-31 09:12:03 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
int H, W;
cin >> H >> W;
vector<int> A(W);
for (int i = 0; i < W; i++) cin >> A[i];
int ans = 0;
vector<string> S(H, string(W, '.'));
int last_put = -1;
int all_ok = 0;
for (int i = 0; i < W; i++) {
for (int j = 0; j <= last_put; j++) {
if (A[i] == 0) break;
S[j][i] = '#';
A[i]--;
}
if (A[i] > 0) {
ans++;
for (int j = H - 1; j >= -1; j--) {
if (A[i] == 0) {
last_put = max(last_put, j + 1);
break;
}
S[j][i] = '#';
A[i]--;
}
} else {
// if (all_ok == 1) continue;
// for (int j = i + 1; j < W; j++) {
// if (A[j] > last_put + 1) {
// S[0][i] = '.';
// S[H - 1][i] = '#';
// ans++;
// last_put = H - 1;
// break;
// }
// }
// all_ok = 1;
}
}
cout << ans << endl;
for (auto a : S) cout << a << endl;
}
int main() {
int T;
cin >> T;
while (T--) {
solve();
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3568kb
input:
4 2 4 1 1 1 1 3 3 3 3 3 4 4 4 3 2 1 4 5 2 3 4 3 2
output:
1 .### #... 3 ### ### ### 2 #### #.#. ##.. ##.. 2 .#### .#### ####. #.#..
result:
wrong answer Wrong score (test case 4)