結果

問題 No.1984 [Cherry 4th Tune *] Dilemma
ユーザー KudeKude
提出日時 2022-06-17 23:12:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,944 bytes
コンパイル時間 3,097 ms
コンパイル使用メモリ 230,672 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-26 01:47:46
合計ジャッジ時間 7,500 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 WA -
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
6,940 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 2 ms
6,940 KB
testcase_18 WA -
testcase_19 AC 2 ms
6,940 KB
testcase_20 WA -
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 3 ms
6,944 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 3 ms
6,944 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
namespace {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#include<atcoder/all>
#pragma GCC diagnostic pop
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; }
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;

} int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, k, p;
  cin >> n >> m >> k >> p;
  VI e(n), f(m), v(k);
  rep(i, n) cin >> e[i];
  rep(i, m) cin >> f[i];
  rep(i, k) cin >> v[i];
  const int se = 0, sf = n, sv = sf + m, s = sv + k, t = s + 1;
  mf_graph<ll> g(t + 1);
  rep(i, k) g.add_edge(s, sv + i, v[i]);
  ll ans = accumulate(all(e), 0LL) + accumulate(all(f), 0LL);
  rep(i, n) g.add_edge(se + i, t, e[i]);
  rep(i, m) g.add_edge(s, sf + i, f[i]);
  constexpr ll INF = 100LL * 1001001001;
  rep(i, n) {
    int l;
    cin >> l;
    rep(_, l) {
      int ai;
      cin >> ai;
      ai--;
      g.add_edge(sv + ai, se + i, INF);
    }
  }
  rep(_, p) {
    int i, j;
    cin >> i >> j;
    i--, j--;
    g.add_edge(sf + j, se + i, INF);
  }
  auto flow = g.flow(s, t);
  ans -= flow;
  cout << ans << '\n';
  vector<P> ms;
  auto c = g.min_cut(t);
  rep(i, k) if (c[sv + i]) {
    ms.emplace_back(0, i);
  }
  rep(i, n) if (c[se + i]) {
    ms.emplace_back(1, i);
  }
  rep(i, m) if (!c[sf + i]) {
    ms.emplace_back(2, i);
  }
  cout << ms.size() << '\n';
  for(auto [t, i]: ms) {
    cout << (t == 0 ? "Preparation" : t == 1 ? "Goal" : "Action") << ' ' << i + 1 << '\n';
  }
}
0