結果

問題 No.568 じゃんじゃん 落とす 委員会
ユーザー Kazuki TakehiKazuki Takehi
提出日時 2023-10-07 14:52:50
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,634 bytes
コンパイル時間 2,876 ms
コンパイル使用メモリ 249,408 KB
実行使用メモリ 14,320 KB
最終ジャッジ日時 2023-10-07 14:52:57
合計ジャッジ時間 5,993 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
14,268 KB
testcase_01 AC 63 ms
14,320 KB
testcase_02 AC 5 ms
8,360 KB
testcase_03 AC 5 ms
8,164 KB
testcase_04 AC 5 ms
8,236 KB
testcase_05 AC 4 ms
8,176 KB
testcase_06 AC 5 ms
8,484 KB
testcase_07 AC 4 ms
8,164 KB
testcase_08 AC 4 ms
8,228 KB
testcase_09 AC 5 ms
8,172 KB
testcase_10 AC 4 ms
8,176 KB
testcase_11 AC 4 ms
8,176 KB
testcase_12 AC 57 ms
14,124 KB
testcase_13 AC 60 ms
14,184 KB
testcase_14 AC 57 ms
14,056 KB
testcase_15 AC 59 ms
14,004 KB
testcase_16 AC 56 ms
13,748 KB
testcase_17 AC 53 ms
13,864 KB
testcase_18 AC 70 ms
13,808 KB
testcase_19 AC 58 ms
13,984 KB
testcase_20 AC 54 ms
14,084 KB
testcase_21 AC 58 ms
13,744 KB
testcase_22 WA -
testcase_23 AC 4 ms
8,228 KB
testcase_24 AC 5 ms
8,176 KB
testcase_25 AC 4 ms
8,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fore(i,a) for(auto &i:a)
#define rep(i,a,b) for(ll i = a; i < b; i++)
#define rrep(i,a,b) for(ll i = a; i >= b; i--)
#define all(obj) (obj).begin(), (obj).end()
using Pl = pair<ll, ll>;
using Pi = pair<int, int>;
using Vl = vector<ll>;
using VVl = vector<Vl>;
using Vi = vector<int>;
using VVi = vector<Vi>;
using Vb = vector<bool>;
using VVb = vector<Vb>;
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
const int inf = INT_MAX / 2;
const ll infl = 1LL << 62;
template <class T, class U>
bool chmax(T &a, const U &b) { return a < b ? (a = b, 1) : 0; }
template <class T, class U>
bool chmin(T &a, const U &b) { return a > b ? (a = b, 1) : 0; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const ll  MAX_DIFF = 101010;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  ll  n, m; cin >> n >> m;
  Vl  x(n), a(n), b(n);
  Vl  A[MAX_DIFF], B[MAX_DIFF];
  Vl  cnt(6, 0);
  rep(i, 0, n) {
    cin >> x[i] >> a[i] >> b[i];
    A[a[i]].push_back(i);
    B[b[i]].push_back(i);
  }
  rep(i, 0, n)
    cnt[++x[i]]++;
  ll  ans = infl, sb = 100001;
  for (ll sa = 0; sa <= 100000; sa++) {
    while (cnt[2] + cnt[3] + cnt[4] + cnt[5] < m and sb > 0) {
      sb--;
      fore(i, B[sb]) {
        cnt[x[i]]--;
        x[i]++;
        cnt[x[i]]++;
      }
    }
    if (cnt[2] + cnt[3] + cnt[4] + cnt[5] < m) break;
    chmin(ans, cnt[3] + cnt[4] + cnt[5]);
    fore(i, A[sa]) {
      cnt[x[i]]--;
      x[i]--;
      cnt[x[i]]++;
    }
  }
  cout << ans << endl;

  return 0;
}
0