結果

問題 No.568 じゃんじゃん 落とす 委員会
ユーザー mamekinmamekin
提出日時 2017-09-09 22:48:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,404 bytes
コンパイル時間 927 ms
コンパイル使用メモリ 106,848 KB
実行使用メモリ 12,252 KB
最終ジャッジ日時 2023-08-20 09:48:38
合計ジャッジ時間 3,815 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 6 ms
7,812 KB
testcase_03 AC 6 ms
7,720 KB
testcase_04 AC 6 ms
7,792 KB
testcase_05 AC 6 ms
7,900 KB
testcase_06 AC 7 ms
7,924 KB
testcase_07 AC 6 ms
7,892 KB
testcase_08 AC 6 ms
7,820 KB
testcase_09 AC 6 ms
7,856 KB
testcase_10 AC 7 ms
7,872 KB
testcase_11 AC 6 ms
7,744 KB
testcase_12 AC 108 ms
11,780 KB
testcase_13 AC 109 ms
11,860 KB
testcase_14 AC 108 ms
11,892 KB
testcase_15 AC 104 ms
11,932 KB
testcase_16 AC 99 ms
11,884 KB
testcase_17 AC 103 ms
11,704 KB
testcase_18 AC 103 ms
11,888 KB
testcase_19 AC 107 ms
11,756 KB
testcase_20 AC 103 ms
11,716 KB
testcase_21 AC 103 ms
11,756 KB
testcase_22 AC 109 ms
12,076 KB
testcase_23 AC 7 ms
7,836 KB
testcase_24 AC 6 ms
7,720 KB
testcase_25 AC 6 ms
7,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

const int MAX_NUM    = 5;
const int DIFFICULTY = 100000;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> x(n);
    vector<vector<int> > va(DIFFICULTY+1), vb(DIFFICULTY+1);
    for(int i=0; i<n; ++i){
        int a, b;
        cin >> x[i] >> a >> b;
        va[a].push_back(i);
        vb[b].push_back(i);

    }

    vector<int> cnt(MAX_NUM+1, 0);
    for(int i=0; i<n; ++i){
        ++ x[i];
        ++ cnt[x[i]];
    }
    for(int i=MAX_NUM; i>0; --i)
        cnt[i-1] += cnt[i];

    int a = 0;
    int ans = INT_MAX;
    for(int b=DIFFICULTY; b>=0; --b){
        for(int i : vb[b]){
            ++ x[i];
            ++ cnt[x[i]];
        }
        while(cnt[2] >= m){
            ans = min(ans, cnt[3]);
            if(a > DIFFICULTY)
                break;
            for(int i : va[a]){
                -- cnt[x[i]];
                -- x[i];
            }
            ++ a;
        }
    }
    cout << ans << endl;

    return 0;
}
0