QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#690976#7943. LIS on GridKowerKoint#WA 0ms3568kbC++231.1kb2024-10-31 09:12:032024-10-31 09:12:03

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 09:12:03]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3568kb
  • [2024-10-31 09:12:03]
  • 提交

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();
  }
}

Details

Tip: Click on the bar to expand more detailed information

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)