結果
問題 | No.568 じゃんじゃん 落とす 委員会 |
ユーザー | nanophoto12 |
提出日時 | 2017-09-10 00:17:50 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 136 ms / 1,000 ms |
コード長 | 1,495 bytes |
コンパイル時間 | 788 ms |
コンパイル使用メモリ | 93,232 KB |
実行使用メモリ | 60,656 KB |
最終ジャッジ日時 | 2023-08-20 09:48:43 |
合計ジャッジ時間 | 4,338 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 135 ms
60,656 KB |
testcase_01 | AC | 136 ms
60,600 KB |
testcase_02 | AC | 28 ms
54,564 KB |
testcase_03 | AC | 27 ms
54,568 KB |
testcase_04 | AC | 26 ms
54,712 KB |
testcase_05 | AC | 25 ms
54,560 KB |
testcase_06 | AC | 27 ms
54,600 KB |
testcase_07 | AC | 27 ms
54,592 KB |
testcase_08 | AC | 24 ms
54,612 KB |
testcase_09 | AC | 25 ms
54,644 KB |
testcase_10 | AC | 25 ms
54,624 KB |
testcase_11 | AC | 27 ms
54,572 KB |
testcase_12 | AC | 125 ms
60,320 KB |
testcase_13 | AC | 133 ms
60,360 KB |
testcase_14 | AC | 127 ms
60,384 KB |
testcase_15 | AC | 130 ms
60,452 KB |
testcase_16 | AC | 125 ms
60,248 KB |
testcase_17 | AC | 121 ms
60,284 KB |
testcase_18 | AC | 123 ms
60,396 KB |
testcase_19 | AC | 127 ms
60,372 KB |
testcase_20 | AC | 123 ms
60,428 KB |
testcase_21 | AC | 124 ms
60,288 KB |
testcase_22 | AC | 133 ms
60,596 KB |
testcase_23 | AC | 26 ms
54,564 KB |
testcase_24 | AC | 25 ms
54,560 KB |
testcase_25 | AC | 24 ms
54,600 KB |
ソースコード
#include <cmath> #include <vector> #include <list> #include <map> #include <set> #include <functional> #include <queue> #include <iostream> #include <string.h> #include <iomanip> #include <algorithm> #include <functional> #include <cstdint> #include <climits> #include <unordered_set> #include <sstream> #include <stack> using namespace std; typedef long long int ll; typedef tuple<int,int,int> t3; using namespace std; int n,m; #define MAX_N 1000010 int x[MAX_N]; int a[MAX_N]; int b[MAX_N]; vector<int> ai[MAX_N]; vector<int> bi[MAX_N]; int c[10]; int two() { return c[2] + c[3] + c[4] + c[5]; } int three() { return c[3] + c[4] + c[5]; } void solve() { cin >> n >> m; for(int i = 0;i < n;i++) { cin >> x[i] >> a[i] >> b[i]; ai[a[i]].push_back(i); bi[b[i]].push_back(i); } //b max for(int i = 0;i < n;i++) { x[i]++; c[x[i]]++; } ll ans = 1e15; int cb = 1000001; for(int ca = 0; ca < 1000001;ca++) { while(two() < m) { cb--; if(cb < 0) break; for(auto i : bi[cb]) { c[x[i]]--; x[i]++; c[x[i]]++; } } if(two() < m) break; ans = min(ans, (ll)three()); for(auto i : ai[ca]) { c[x[i]]--; x[i]--; c[x[i]]++; } } cout << ans << endl; } int main() { solve(); return 0; }