結果

問題 No.2680 研究室配属
ユーザー tnakao0123tnakao0123
提出日時 2024-04-26 14:11:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 776 bytes
コンパイル時間 483 ms
コンパイル使用メモリ 43,056 KB
実行使用メモリ 7,776 KB
最終ジャッジ日時 2024-04-26 14:11:38
合計ジャッジ時間 3,836 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 4 ms
5,376 KB
testcase_06 AC 5 ms
5,376 KB
testcase_07 AC 5 ms
5,376 KB
testcase_08 AC 5 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 16 ms
5,376 KB
testcase_11 AC 15 ms
5,632 KB
testcase_12 AC 22 ms
5,632 KB
testcase_13 AC 17 ms
6,016 KB
testcase_14 AC 21 ms
6,144 KB
testcase_15 AC 5 ms
6,272 KB
testcase_16 AC 45 ms
6,528 KB
testcase_17 AC 10 ms
6,912 KB
testcase_18 AC 30 ms
6,944 KB
testcase_19 AC 60 ms
7,040 KB
testcase_20 AC 51 ms
7,360 KB
testcase_21 AC 8 ms
7,424 KB
testcase_22 AC 37 ms
7,760 KB
testcase_23 AC 96 ms
7,652 KB
testcase_24 AC 95 ms
7,776 KB
testcase_25 AC 96 ms
7,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2680.cc:  No.2680 研究室配属 - yukicoder
 */

#include<cstdio>
#include<algorithm>
 
using namespace std;

/* constant */

const int MAX_N = 1000;
const int MAX_M = 1000;

/* typedef */

/* global variables */

int as[MAX_M], ts[MAX_N][MAX_M], ls[MAX_N];

/* subroutines */

/* main */

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int j = 0; j < m; j++) scanf("%d", as + j);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", ts[i] + j);

  fill(ls, ls + n, -1);
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < n; i++)
      if (ls[i] < 0 && as[ts[i][j]])
	ls[i] = ts[i][j], as[ts[i][j]]--;
  }

  for (int i = 0; i < n; i++)
    printf("%d%c", ls[i], (i + 1 < n) ? ' ' : '\n');
  
  return 0;
}
0