結果

問題 No.2680 研究室配属
ユーザー cho435cho435
提出日時 2024-03-20 21:08:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 275 ms / 2,000 ms
コード長 773 bytes
コンパイル時間 4,649 ms
コンパイル使用メモリ 270,496 KB
実行使用メモリ 10,240 KB
最終ジャッジ日時 2024-03-20 21:08:09
合計ジャッジ時間 7,226 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 6 ms
6,548 KB
testcase_06 AC 8 ms
6,548 KB
testcase_07 AC 7 ms
6,548 KB
testcase_08 AC 7 ms
6,548 KB
testcase_09 AC 5 ms
6,548 KB
testcase_10 AC 31 ms
6,548 KB
testcase_11 AC 29 ms
6,548 KB
testcase_12 AC 40 ms
6,548 KB
testcase_13 AC 32 ms
6,548 KB
testcase_14 AC 43 ms
6,548 KB
testcase_15 AC 7 ms
6,548 KB
testcase_16 AC 99 ms
6,548 KB
testcase_17 AC 18 ms
6,548 KB
testcase_18 AC 59 ms
6,548 KB
testcase_19 AC 127 ms
6,548 KB
testcase_20 AC 103 ms
6,548 KB
testcase_21 AC 11 ms
6,548 KB
testcase_22 AC 75 ms
6,548 KB
testcase_23 AC 211 ms
7,680 KB
testcase_24 AC 213 ms
7,680 KB
testcase_25 AC 275 ms
10,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
	int n,m;
	cin>>n>>m;
	vector<int> a(m);
	rep(i,m) cin>>a.at(i);
	vector<vector<int>> t(n,vector<int>(m,0));
	rep(i,n) rep(j,m) cin>>t.at(i).at(j);
	vector<vector<int>> ans(m);
	set<int> st;
	rep(i,n) st.insert(i);
	rep(c,m){
		if(st.empty()) break;
		for(int x:st){
			ans.at(t.at(x).at(c)).push_back(x);
		}
		set<int> nst;
		rep(i,m){
			while((int)ans.at(i).size()>a.at(i)){
				nst.insert(ans.at(i).back());
				ans.at(i).pop_back();
			}
		}
		swap(st,nst);
	}
	vector<int> v(n);
	rep(i,m){
		for(int x:ans.at(i)){
			v.at(x)=i;
		}
	}
	rep(i,n) cout<<v.at(i)<<" ";
	cout<<endl;
}
0