結果
問題 | No.2372 既視感 |
ユーザー |
![]() |
提出日時 | 2024-02-03 11:59:14 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 1,697 bytes |
コンパイル時間 | 3,241 ms |
コンパイル使用メモリ | 253,752 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-28 10:47:24 |
合計ジャッジ時間 | 4,223 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h>using namespace std;#ifdef DEBUG_#include <compe/debug.hpp>#else#define dump(...)#endif#define FastIO cin.tie(nullptr), ios_base::sync_with_stdio(false);#define rep(i, n) for (int i = 0; i < (int)(n); ++i)#define output(msg) cout << (msg) << '\n'#define die(msg) \do { \cout << msg << endl; \exit(0); \} while (0)#define all(k) k.begin(), k.end()#define INFi 1 << 30#define INFll 1LL << 60template <typename T> bool chmax(T& a, const T& b) {return ((a < b) ? (a = b, true) : (false));}template <typename T> bool chmin(T& a, const T& b) {return ((a > b) ? (a = b, true) : false);}using llint = long long int;void solve(vector<string>& ai) {string s;cin >> s;ai.push_back(s);}void asakatsu(vector<string>& ai, const int N, const int K) {vector<string> ti(6);vector<int> di(6);rep(i, 6) cin >> ti[i] >> di[i];int idx = max(0, (int)ai.size() - N);rep(i, 6) {bool exists = false;for (int j = idx; j < (int)ai.size(); ++j) {if (ai[j] == ti[i]) exists = true;if (exists) chmin(di[i], K);}}// solverint total{}, cnt{};rep(i, 6) {if (total + di[i] <= 60) {cnt++;total += di[i];} else {break;}}// outputoutput(cnt);rep(i, cnt) {ai.push_back(ti[i]);}}int main() {FastIO;int N, K, Q;cin >> N >> K >> Q;bool no_solve{true};set<string> st;vector<string> ai;rep(_, Q) {int query;cin >> query;if (query == 1) {solve(ai);} else {no_solve = false;asakatsu(ai, N, K);}}if (no_solve) cout << '\n';}