結果

問題 No.2372 既視感
ユーザー kinugoshi8928kinugoshi8928
提出日時 2023-07-07 22:20:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 2,058 bytes
コンパイル時間 6,393 ms
コンパイル使用メモリ 416,336 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-28 23:45:00
合計ジャッジ時間 7,689 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 3 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 4 ms
4,380 KB
testcase_24 AC 4 ms
4,376 KB
testcase_25 AC 4 ms
4,380 KB
testcase_26 AC 4 ms
4,380 KB
testcase_27 AC 4 ms
4,380 KB
testcase_28 AC 10 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
namespace std {
template <typename T, typename U>
istream &operator>>(istream &is, pair<T, U> &v) {
    is >> v.first >> v.second;
    return is;
}
template <typename T> istream &operator>>(istream &is, vector<T> &v) {
    for(T &in : v)
        is >> in;
    return is;
}
} // namespace std
#include <atcoder/all>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace atcoder;
using namespace boost::multiprecision;
using ll = long long;
using mint = modint998244353;
#define all(v) v.begin(), v.end()
#define rep(a, b) for(long long a = 0; a < (long long)(b); a++)
int op(int a, int b) { return min(a, b); }
int e() { return 2147483647; }

int main() {
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<string> A;
    int siten = 0;
    rep(fjdfjsdkal, Q) {
        int que;
        cin >> que;
        if(que == 1) {
            string s;
            cin >> s;
            A.push_back(s);
            if(A.size() - siten == N + 1)
                siten++;
        }
        if(que == 2) {
            vector<pair<string, int>> T(6);
            cin >> T;
            int time = 0;
            int ret = 0;
            rep(i, 6) {
                bool sonzai = false;
                for(int j = siten; j < A.size(); j++) {
                    if(T[i].first == A[j])
                        sonzai = true;
                }
                if(sonzai) {
                    if(time + min(T[i].second, K) <= 60) {
                        time += min(T[i].second, K);
                        ret++;
                    } else
                        break;
                } else {
                    if(time + T[i].second <= 60) {
                        time += T[i].second;
                        ret++;
                    } else
                        break;
                }
            }
            cout << ret << endl;
            rep(i, ret) {
                A.push_back(T[i].first);
                if(A.size() - siten == N + 1)
                    siten++;
            }
        }
    }
}
0