結果
| 問題 |
No.2680 研究室配属
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-23 16:56:58 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 76 ms / 2,000 ms |
| コード長 | 659 bytes |
| コンパイル時間 | 1,634 ms |
| コンパイル使用メモリ | 200,332 KB |
| 最終ジャッジ日時 | 2025-02-20 13:24:34 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N,M;
cin>>N>>M;
vector A(M,0);
for(int &i:A)cin>>i;
vector T(N,vector(M,0));
for(int i=0;i<N;i++){
for(int j=0;j<M;j++)cin>>T[i][j];
}
vector ans(N,-1);
for(int i=0;i<M;i++){
vector tmp(M,vector(0,0));
for(int j=0;j<N;j++){
if(ans[j]==-1){
tmp[T[j][i]].push_back(j);
}
}
for(int j=0;j<M;j++){
for(auto k:tmp[j]){
if(A[j]>0){
ans[k]=j;
A[j]-=1;
}
}
}
}
for(int i=0;i<N;i++){
cout<<ans[i]<<" \n"[i==N-1];
}
}