結果

問題 No.177 制作進行の宮森あおいです!
ユーザー nanasilinanasili
提出日時 2015-04-10 18:31:35
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,289 bytes
コンパイル時間 578 ms
コンパイル使用メモリ 83,148 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-17 19:10:10
合計ジャッジ時間 1,355 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,384 KB
testcase_15 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <vector>
#include <cfloat>
#include <string>
#include <cmath>
#include <set>
#include <cstdlib>
#include <map>
#include <ctime>
#include <iomanip>
#include <functional>
#include <deque>
#include <iostream>
#include <cstring>
#include <queue>
#include <cstdio>
#include <stack>
#include <climits>
#include <sys/time.h>
#include <cctype>

using namespace std;

typedef long long ll;

int main() {
  ll w;
  cin >> w;
  ll n;
  cin >> n;
  ll j[n];
  for (int i = 0; i < n; i++) {
    cin >> j[i];
  }
  ll m;
  cin >> m;
  ll c[m];
  for (int i = 0; i < m; i++) {
    cin >> c[i];
  }

  bool no[n][m];
  memset(no, false, sizeof(no));

  for (int i = 0; i < m; i++) {
    ll q;
    cin >> q;
    for (int l = 0; l < q; l++) {
      ll t;
      cin >> t;
      no[t-1][i] = true;
    }
  }

  ll sum = 0;
  for (int i = 0; i < n; i++) {
    ll p = -1;
    for (int l = 0; l < m; l++) {
      if (!no[i][l]) {
	p = l;
	break;
      }
    }
    if (p == -1) {
      continue;
    }
    for (int l = 0; l < m; l++) {
      if (c[p] < c[l] && !no[i][l]) {
	p = l;
      }
    }
    sum += min(c[p], j[i]);
    c[p] -= min(c[p], j[i]);
  }

  if (sum >= w) {
    std::cout << "SHIROBAKO" << std::endl;
  }else {
    std::cout << "BANSAKUTSUKITA" << std::endl;
  }
}
0