結果

問題 No.2680 研究室配属
ユーザー futamegawa
提出日時 2024-03-20 21:54:43
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 199 ms / 2,000 ms
コード長 991 bytes
コンパイル時間 2,960 ms
コンパイル使用メモリ 250,136 KB
実行使用メモリ 7,552 KB
最終ジャッジ日時 2024-09-30 07:43:29
合計ジャッジ時間 5,622 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using llu = long long unsigned;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> A(M);
    for (auto &x : A) { cin >> x; }
    vector<vector<int>> T(N, vector<int>(M));
    for (uint i=0; i<N; ++i) {
        for (uint j=0; j<M; ++j) {
            cin >> T[i][j];
        }
    }

    //for (auto x : A) { cout << x << " "; } cout << endl;
    //for (auto x : T) {
    //    for (auto y : x) { cout << y << " "; } cout << endl;
    //}

    vector<int> ret(N, -1);
    vector<int> data(M, 0);

    for (uint j=0; j<M; ++j) {
        for (uint i=0; i<N; ++i) {
            if (ret[i] != -1) continue;
            int Mdash = T[i][j];
            if (data[Mdash] < A[Mdash]) {
                data[Mdash]++;
                ret[i] = Mdash;
            }
        }
    }
    //for (auto x : data) { cout << x << " "; } cout << endl;
    for (auto x : ret) { cout << x << " "; }
    cout << endl;
    return 0;
}
0