結果

問題 No.2372 既視感
ユーザー michael_381michael_381
提出日時 2023-07-07 22:00:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 2,992 bytes
コンパイル時間 2,605 ms
コンパイル使用メモリ 105,552 KB
実行使用メモリ 11,980 KB
最終ジャッジ日時 2023-09-28 23:14:58
合計ジャッジ時間 7,819 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _GLIBCXX_DEBUG
// kyopuro2.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cassert>
#include <bitset>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

const long long INF = 1LL << 60;

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

using ll = long long;
using ch = char;
using st = string;
using vi = vector<int>;
using vll = vector<ll>;
using vb = vector<bool>;
using vc = vector<ch>;
using vs = vector<st>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvc = vector<vc>;
using vvs = vector<vs>;
using pii = pair<int, int>;
using vpii = vector <pii>;
using p_qi = priority_queue<int>;

// DP テーブル
ll dp[100008];


int main() {
	int N, K, Q;
	cin >> N >> K >> Q;
	st s;
	vector<st> A(0);
	vs C(6);
	int query,d,count;
	int sum = 0;
	bool can;
	rep(i, Q) {
		sum = 0;
		can = false;
		count = 0;
		cin >> query;
		if (query == 1) {
			cin >> s;
			A.push_back(s);
		}
		else {
			rep(j, 6) {
				can = false;
				cin >> C[j] >> d;
				int sixe = A.size();
				int y = max(-1, sixe - N);

				for (int k = A.size() - 1; k > y; i--) {
					if (A[k] == C[j]) {
						can = true;
					}
				}
				if (can) sum += min(d, K);
				else sum += d;
				if (sum > 60) {
					count = j;
					break;
				}
				if (j == 5) {
					count = 6;
				}
			}
			cout << count << "\n";
			rep(l, count) {
				A.push_back(C[l]);
			}
		}
	}
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


0