結果

問題 No.2680 研究室配属
ユーザー haihamabossuhaihamabossu
提出日時 2024-03-20 21:58:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 628 bytes
コンパイル時間 2,168 ms
コンパイル使用メモリ 207,536 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-03-20 21:58:58
合計ジャッジ時間 3,930 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 AC 4 ms
6,548 KB
testcase_06 AC 4 ms
6,548 KB
testcase_07 AC 4 ms
6,548 KB
testcase_08 AC 4 ms
6,548 KB
testcase_09 AC 3 ms
6,548 KB
testcase_10 AC 13 ms
6,548 KB
testcase_11 AC 12 ms
6,548 KB
testcase_12 AC 15 ms
6,548 KB
testcase_13 AC 12 ms
6,548 KB
testcase_14 AC 17 ms
6,548 KB
testcase_15 AC 5 ms
6,548 KB
testcase_16 AC 35 ms
7,040 KB
testcase_17 AC 7 ms
6,548 KB
testcase_18 AC 22 ms
6,548 KB
testcase_19 AC 46 ms
8,064 KB
testcase_20 AC 37 ms
7,168 KB
testcase_21 AC 5 ms
6,548 KB
testcase_22 AC 29 ms
6,548 KB
testcase_23 AC 73 ms
11,264 KB
testcase_24 AC 74 ms
11,264 KB
testcase_25 AC 77 ms
11,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

void solve() {
  ll n, m;
  cin >> n >> m;
  vector<ll> a(m), c(m, 0), ans(n, -1);
  rep(i, m) cin >> a[i];
  vector t(n, vector<ll>(m));
  rep(j, n) rep(k, m) cin >> t[j][k];
  rep(k, m) rep(j, n) {
    ll x = t[j][k];
    if (ans[j] == -1 && c[x] < a[x])
      c[x]++, ans[j] = x;
  }
  rep(i, n) cout << (i ? " " : "") << ans[i];
  cout << '\n';
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  int T = 1;
  for (int t = 0; t < T; t++) {
    solve();
  }
  return 0;
}
0