結果

問題 No.2680 研究室配属
コンテスト
ユーザー elphe
提出日時 2024-10-24 19:08:52
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 672 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 404 ms
コンパイル使用メモリ 94,692 KB
実行使用メモリ 9,224 KB
最終ジャッジ日時 2026-07-06 01:16:19
合計ジャッジ時間 3,774 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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