結果
| 問題 | No.1465 Archaea | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-07-28 00:12:41 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 6 ms / 2,000 ms | 
| コード長 | 776 bytes | 
| コンパイル時間 | 687 ms | 
| コンパイル使用メモリ | 71,040 KB | 
| 実行使用メモリ | 6,528 KB | 
| 最終ジャッジ日時 | 2024-12-24 01:06:39 | 
| 合計ジャッジ時間 | 1,703 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 20 | 
ソースコード
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef pair<bool, long long> P;
int main() {
	long long N, K; cin >> N >> K;
	vector<P>A(N + 1, make_pair(false, 1000000009));
	A.at(0) =make_pair(true, 0); A.at(1) = make_pair(true, 0);
	for (long long i = 2; i <= N; i++) {
		if (i % 2 == 0) {
			if (A.at(i / 2).first) A.at(i) = make_pair(true, min(A.at(i / 2).second + 1, A.at(i).second));
			if (i > 3) {
				if (A.at(i - 3).first) A.at(i) = make_pair(true, min(A.at(i - 3).second + 1, A.at(i).second));
			}
		}
		else {
			if (i > 3) {
				if (A.at(i - 3).first) A.at(i) = make_pair(true, min(A.at(i - 3).second + 1, A.at(i).second));
			}
		}
	}
	if (A.at(N).first && A.at(N).second <= K) cout << "YES" << endl;
	else cout << "NO" << endl;
}
            
            
            
        