結果

問題 No.2372 既視感
ユーザー as277575as277575
提出日時 2023-07-07 22:00:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 1,581 bytes
コンパイル時間 1,367 ms
コンパイル使用メモリ 124,348 KB
最終ジャッジ日時 2025-02-15 07:23:23
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <algorithm>
#include <bit>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <random>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <set>
#include <string>
using namespace::std;
template<typename T, typename U>
ostream& operator<< (ostream& o, const pair<T, U>& p) {
o << "<" << p.first << ", " << p.second << ">";
return o;
}
template <typename T>
ostream& operator<< (ostream& o, const vector<T>& v) {
for (const auto& x : v) o << x << " ";
return o;
}
ostream& operator<<(ostream& o, const unordered_map<long long, long long>& m) {
o << "{";
for (const auto& [k, v] : m)
o << " " << k << ": " << v << ",";
o << "}";
return o;
}
template <typename T>
istream& operator>> (istream& i, vector<T>& v) {
for (auto& x : v) i >> x;
return i;
}
int main() {
ios::sync_with_stdio(false);
int n, k, q;
cin >> n >> k >> q;
deque<string> dq;
for (int i = 0; i < q; ++i) {
int t;
cin >> t;
if (t == 1) {
string s;
cin >> s;
dq.push_back(s);
} else {
int l = 60, r = 0;
for (int j = 0; j < 6; ++j) {
string s;
int d;
cin >> s >> d;
if (find(dq.begin(), dq.end(), s) != dq.end())
d = min(d, k);
l -= d;
cerr << "AFTER " << s << " l=" << l << endl;
if (l >= 0) {
++r;
dq.push_back(s);
}
}
cout << r << endl;
}
while (dq.size() > n) dq.pop_front();
}
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0