結果

問題 No.2680 研究室配属
ユーザー daiota
提出日時 2024-03-20 22:47:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 1,621 ms
コンパイル使用メモリ 167,580 KB
実行使用メモリ 7,424 KB
最終ジャッジ日時 2024-09-30 08:54:49
合計ジャッジ時間 3,186 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> Q;
#define REP(i,n) for(int i=0;i<int(n);i++)


int A[1010],T[1010][1010];


int main(){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
    int i,j,k;


    int N,M;
    cin >> N >> M;

    REP(i,M) cin >> A[i];
    REP(i,N) REP(j,M) cin >> T[i][j];


    vector<int> v(N,-1);
    REP(j,M) REP(i,N){
    	if(v[i]!=-1) continue;
    	int x=T[i][j];
    	if(A[x]==0) continue;

    	v[i]=x;
    	A[x]--;

    }


    REP(i,N) cout << v[i] << ' ';
    cout << endl;




	return 0;

}
0