結果

問題 No.3211 NAND Oracle
ユーザー kokosei
提出日時 2025-07-25 22:50:37
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,042 bytes
コンパイル時間 896 ms
コンパイル使用メモリ 88,200 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-07-25 22:50:47
合計ジャッジ時間 4,747 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

int Q, K;
int main(void){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	cin >> Q >> K;
	// [0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0]
	// [0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0]
	// [1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0]
	// [1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0]
	//        2, 3, 3, 4, 4, 5, 5, 5, 5, 5, .. 
	vector<pair<int, int> > ans;
	if(Q >= 6){
		if(K < 5){
			cout << "No\n";
			return 0;
		}
		cout << "Yes\n";
		ans.push_back({0, 1});
		ans.push_back({0, 2});
		ans.push_back({1, 3});
		ans.push_back({1, 4});
		ans.push_back({1, 4});
		for(int i = 0;i < Q - 5;i++) ans.push_back({5, 6});
		for(auto [a, b] : ans){
			cout << a + 1 << " " << b + 1 << "\n";
		}
		return 0;
	}

	if(K < (Q + 1) / 2 + 1){
		cout << "No\n";
		return 0;
	}
	cout << "Yes\n";
	ans.push_back({0, 1});
	if(Q > 1)ans.push_back({0, 2});
	for(int i = 0;i < Q - 2;i++){
		ans.push_back({i % 2 + 1, i % 2 + 3});
	}
	for(auto [a, b] : ans){
		cout << a + 1 << " " << b + 1 << "\n";
	}
	return 0;
}

0