結果

問題 No.2680 研究室配属
ユーザー elphe
提出日時 2024-10-24 19:08:52
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 672 bytes
コンパイル時間 728 ms
コンパイル使用メモリ 75,608 KB
最終ジャッジ日時 2025-02-24 22:38:29
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdint>
#include <vector>

using namespace std;

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	uint16_t N, M, i, j;
	cin >> N >> M;
	vector<uint16_t> A(M);
	for (i = 0; i != M; ++i) cin >> A[i];
	vector<vector<uint16_t>> T(N, vector<uint16_t>(M));
	for (i = 0; i != N; ++i)
		for (j = 0; j != M; ++j)
			cin >> T[i][j];

	vector<uint16_t> count(M, 0), ans(N, UINT16_MAX);
	for (i = 0; i != M; ++i)
		for (j = 0; j != N; ++j)
			if (ans[j] == UINT16_MAX && count[T[j][i]] != A[T[j][i]])
				++count[T[j][i]], ans[j] = T[j][i];

	cout << ans[0];
	for (i = 1; i != N; ++i)
		cout << ' ' << ans[i];
	cout << '\n';

	return 0;
}
0