結果

問題 No.3211 NAND Oracle
ユーザー alcea
提出日時 2025-07-25 22:09:38
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 248 ms / 2,000 ms
コード長 1,116 bytes
コンパイル時間 1,639 ms
コンパイル使用メモリ 195,516 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-07-25 22:09:44
合計ジャッジ時間 5,951 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
  int q,k;
  cin>>q>>k;
  if(q>=5&&k>=5){
    cout<<"Yes"<<endl;
    cout<<"1 2"<<endl;
    cout<<"1 2"<<endl;
    cout<<"3 4"<<endl;
    cout<<"4 5"<<endl;
    cout<<"4 5"<<endl;
    for(int i=5;i<q;i++) cout<<"6 7"<<endl;
    return 0;
  }
  if(q>=6){
    cout<<"No"<<endl;
    return 0;
  }
  if(q==1){
    cout<<"Yes"<<endl;
    cout<<"1 2"<<endl;
  }
  if(q==2){
    if(k==2) cout<<"No"<<endl;
    else{
      cout<<"Yes"<<endl;
      cout<<"1 2"<<endl;
      cout<<"1 2"<<endl;
    }
  }
  if(q==3){
    if(k==2) cout<<"No"<<endl;
    else{
      cout<<"Yes"<<endl;
      cout<<"1 2"<<endl;
      cout<<"1 2"<<endl;
      cout<<"3 4"<<endl;
    }
  }
  if(q==4){
    if(k<=3) cout<<"No"<<endl;
    else{
      cout<<"Yes"<<endl;
      cout<<"1 2"<<endl;
      cout<<"1 2"<<endl;
      cout<<"3 4"<<endl;
      cout<<"3 4"<<endl;
    }
  }
  if(q==5){
    if(k<=3) cout<<"No"<<endl;
    else{
      cout<<"Yes"<<endl;
      cout<<"1 2"<<endl;
      cout<<"1 2"<<endl;
      cout<<"3 4"<<endl;
      cout<<"3 4"<<endl;
      cout<<"5 6"<<endl;
    }
  }
}
0