結果

問題 No.2680 研究室配属
ユーザー MMMM
提出日時 2024-03-20 21:06:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 1,138 bytes
コンパイル時間 3,897 ms
コンパイル使用メモリ 230,628 KB
実行使用メモリ 7,552 KB
最終ジャッジ日時 2024-03-20 21:06:58
合計ジャッジ時間 6,523 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 3 ms
6,676 KB
testcase_05 AC 6 ms
6,676 KB
testcase_06 AC 8 ms
6,676 KB
testcase_07 AC 7 ms
6,676 KB
testcase_08 AC 7 ms
6,676 KB
testcase_09 AC 4 ms
6,676 KB
testcase_10 AC 30 ms
6,676 KB
testcase_11 AC 44 ms
6,676 KB
testcase_12 AC 41 ms
6,676 KB
testcase_13 AC 29 ms
6,676 KB
testcase_14 AC 43 ms
6,676 KB
testcase_15 AC 7 ms
6,676 KB
testcase_16 AC 97 ms
6,676 KB
testcase_17 AC 17 ms
6,676 KB
testcase_18 AC 59 ms
6,676 KB
testcase_19 AC 128 ms
6,676 KB
testcase_20 AC 103 ms
6,676 KB
testcase_21 AC 10 ms
6,676 KB
testcase_22 AC 75 ms
6,676 KB
testcase_23 AC 211 ms
7,552 KB
testcase_24 AC 212 ms
7,552 KB
testcase_25 AC 211 ms
7,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
#define chmin(x,y) (x) = min((x),(y))
#define chmax(x,y) (x) = max((x),(y))
#define ld long double
using namespace std;
using namespace atcoder;
using ll = long long;
const ll mod = 998244353;
using mint = modint998244353;
//using Graph = vector<vector<pair<int,int>>>;
using Graph = vector<vector<int>>;
const vector<int> dx = {1,0,-1,0}, dy = {0,1,0,-1};

ll sqrtll(ll x) {
  assert(x >= 0);
  ll hi(x), lo(0);
  while (hi != lo) {
    ll y = (hi + lo + 1) / 2;
    if (y <= x/y) lo = y;
    else hi = y - 1;
  }
  return lo;
}


int main(){
  // input 
  int N,M; cin >> N >> M;
  vector<int> A(M);
  for(int i = 0; i < M; i++)
    cin >> A[i];
  vector<vector<int>> T(N,vector<int>(M));
  for(int i = 0; i < N; i++)
    for(int j = 0; j < M; j++)
      cin >> T[i][j];
  
  // solve
  vector<int> ans(N,-1);
  for(int j = 0; j < M; j++){
    for(int i = 0; i < N; i++){
      if(A[T[i][j]] > 0 && ans[i] == -1){
        ans[i] = T[i][j];
        A[T[i][j]]--;
      }
    }
  }
  
  
  // output
  for(int i = 0; i < N; i++){
    if(i) cout << " ";
    cout << ans[i];
  } cout << endl;
}
0