結果

問題 No.2372 既視感
ユーザー hatsuka_iwa
提出日時 2023-07-13 00:20:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 799 bytes
コンパイル時間 1,693 ms
コンパイル使用メモリ 173,952 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-14 12:59:57
合計ジャッジ時間 3,021 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, Q; cin >> N >> K >> Q;
  vector<string> A;

  auto search = [&](string t, int d) {
    int M = A.size();
    for (int i = max(0, M - N); i < M; i++)
      if (t == A.at(i)) return min(K, d);
    return d;
  };
  
  for (int i = 0; i < Q; i++) {
    int Query; cin >> Query;

    if (Query == 1) {
      string S; cin >> S;
      A.push_back(S);
     }
    if (Query == 2) {
      int T = 60, C = 0;
      vector<string> t(6);
      vector<int> d(6);
      for (int i = 0; i < 6; i++)
        cin >> t.at(i) >> d.at(i);

      while (C != 6) {
        int m = search(t.at(C), d.at(C));
        if (m > T) break;
        T -= m;
        C++;
      }

      cout << C << endl;
      for (string S : t) A.push_back(S);
    }
  }
}
0