結果

問題 No.2372 既視感
ユーザー shobonvipshobonvip
提出日時 2023-07-07 22:40:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 1,206 bytes
コンパイル時間 6,201 ms
コンパイル使用メモリ 263,816 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-29 00:13:38
合計ジャッジ時間 7,057 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;

typedef modint998244353 mint;
typedef long long ll;

#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
#define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--)

template <typename T> bool chmin(T &a, const T &b) {
	if (a <= b) return false;
	a = b;
	return true;
}
template <typename T> bool chmax(T &a, const T &b) {
	if (a >= b) return false;
	a = b;
	return true;
}

int main(){
	int n, k, q; cin >> n >> k >> q;
	vector<string> v;
	rep(num,0,q){
		int t; cin >> t;
		if (t == 1){
			string s; cin >> s;
			v.push_back(s);
		}else{
			vector<string> prob(6);
			vector<int> times(6);
			int cnt = 0;
			rep(i,0,6){
				cin >> prob[i] >> times[i];
			}
			int now = 0;
			rep(i,0,6){
				bool isgood = false;
				rep(j,0,n){
					if ((int)v.size()-1-j < 0) break;
					if (v[(int)v.size()-1-j] == prob[i]){
						isgood = true;
						break;
					}
				}
				int dr = times[i];
				if (isgood){
					chmin(dr, k);
				}
				if (now + dr <= 60){
					now += dr;
					cnt++;
				}else{
					break;
				}
			}
			rep(i,0,cnt){
				v.push_back(prob[i]);
			}
			cout << cnt << "\n";
		}

	}
}
0