QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#514059#7943. LIS on GridSwarthmore#WA 0ms3616kbC++201.6kb2024-08-10 21:30:182024-08-10 21:30:20

Judging History

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

  • [2024-08-10 21:30:20]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3616kb
  • [2024-08-10 21:30:18]
  • 提交

answer

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a) - 1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)
#define sz(x) (int)(x).size()
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

const char nl = '\n';

void solve() {
    int N, M; cin >> N >> M;
    vi A(M); F0R(i, M) cin >> A[i];
    vpi cur;
    F0R(i, N) cur.pb({0, -i});
    char ans[N][M]; F0R(i, N) F0R(j, M) ans[i][j] = '.';
    int val[N+1]; F0R(i, N+1) val[i] = 0;
    int nval[N+1]; F0R(i, N+1) nval[i] = 0;
    sort(all(cur));
    F0R(i, M) {
        F0R(j, N+1) nval[j] = val[j];
        trav(a, cur) {
            if (A[i]) {
                ans[-a.s][i] = '#';
                A[i]--;
                nval[-a.s+1] = val[-a.s]+1;
            } 
        }
        F0R(j, N+1) val[j] = nval[j];
        cur.clear();
        F0R(j, N) {
            cur.pb({val[j], -j});
        }
        sort(all(cur));
    }

    cout << val[N] << nl;
    F0R(i, N) {
        F0R(j, M) {
            cout << ans[i][j];
        }
        cout << nl;
    }
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
    int T; cin >> T;
	while (T--) solve();
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3616kb

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
####
#...
###.
##..
3
.####
.####
###..
#.##.

result:

wrong answer Jury found better answer than participant (test case 4)