結果

問題 No.3211 NAND Oracle
コンテスト
ユーザー のらら
提出日時 2025-07-26 00:03:19
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,105 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,232 ms
コンパイル使用メモリ 268,592 KB
実行使用メモリ 9,924 KB
最終ジャッジ日時 2026-10-31 19:15:43
合計ジャッジ時間 6,779 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <algorithm>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
//#define endl "\n";
vector<pair<int, int>> ans = {{1, 2},{2,3},{1,4}};

int main(){
  int Q, K;
  cin >> Q >> K;
  if(Q == 1){
    if(K >= 2){
      cout << "Yes" << endl;
      cout << ans[0].first << " " << ans[0].second << endl;
      return 0;
    }else{
      cout << "No" << endl;
      return 0;
    }
  }
  if(Q == 2 || Q == 3){
    if(K >= 3){
      cout << "Yes" << endl;
      for(int i = 0; i < Q; i++) cout << ans[i].first << " " << ans[i].second << endl;
      return 0;
    }else{
      cout << "No" << endl;
      return 0;
    }
  }
  if(Q >= 4){
    int rest = Q - 3;
    if(K >= 3 + (rest + 1) / 2){
      cout << "Yes" << endl;
      for(int i = 0; i < 3; i++) cout << ans[i].first << " " << ans[i].second << endl;
      for(int i = 0; i < rest; i++){
        if(i % 2 == 0) cout << 3 << " " << 5 << endl;
        else cout << 1 << " " << 4 << endl;
      }
      return 0;
    }else{
      cout << "No" << endl;
      return 0;
    }
  }
  return 0;
}
0