結果
問題 | No.2680 研究室配属 |
ユーザー |
![]() |
提出日時 | 2024-03-20 21:24:09 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 222 ms / 2,000 ms |
コード長 | 828 bytes |
コンパイル時間 | 4,957 ms |
コンパイル使用メモリ | 312,260 KB |
実行使用メモリ | 7,552 KB |
最終ジャッジ日時 | 2024-09-30 07:09:39 |
合計ジャッジ時間 | 7,386 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> #define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) using namespace std; using namespace atcoder; typedef long long ll; int main() { int n, m; cin >> n >> m; vector<int> a(m); rep(i, 0, m) cin >> a[i]; vector<vector<int>> t(n, vector<int>(m)); rep(i, 0, n) rep(j, 0, m) cin >> t[i][j]; vector<int> ans(n, -1); rep(j, 0, m) { set<int> tmp; rep(i, 0, n) { if (ans[i] == -1) { a[t[i][j]]--; ans[i] = t[i][j]; tmp.insert(-i); } } for (auto x : tmp) { x *= -1; if (a[t[x][j]] < 0) { ans[x] = -1; a[t[x][j]]++; } } } rep(i, 0, n) cout << ans[i] << ' '; }