結果

問題 No.3211 NAND Oracle
ユーザー こめだわら
提出日時 2025-07-25 22:07:01
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 322 ms / 2,000 ms
コード長 1,713 bytes
コンパイル時間 3,850 ms
コンパイル使用メモリ 284,280 KB
実行使用メモリ 8,540 KB
最終ジャッジ日時 2025-07-25 22:07:17
合計ジャッジ時間 8,818 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

#define rep(i,n) for(ll i=0;i<n;++i)
#define all(a) (a).begin(),(a).end()
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
template<class T> T div_floor(T a, T b) { return a / b - ((a ^ b) < 0 && a % b); }
template<class T> T div_ceil(T a, T b) { return a / b + ((a ^ b) > 0 && a % b); }
template <typename T, typename U> inline bool chmin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template <typename T, typename U> inline bool chmax(T &x, U y) { return (x < y) ? (x = y, true) : false; }


void solve() {
    ll Q,K;
    cin>>Q>>K;
    vector<ll> lower={2,2,3,3,4,4};
    if (Q<=5){
        if (K<lower[Q]){
            cout<<"No"<<endl;
            return;
        }
    }
    else{
        if (K<5){
            cout<<"No"<<endl;
            return;
        }
    }
    cout<<"Yes"<<endl;
    vector<pair<ll,ll>> op;
    if (Q==5){
        op.push_back({1,2});
        op.push_back({1,2});
        op.push_back({3,4});
        op.push_back({3,4});
        op.push_back({1,2});
    }
    else{
        op.push_back({1,2});
        op.push_back({1,2});
        op.push_back({3,4});
        op.push_back({4,5});
        op.push_back({4,5});
        rep(i,Q-5){
            op.push_back({6,7});
        }
        while (op.size()>Q)op.pop_back();
    }
    for (auto [a,b]:op){
        cout<<a<<' '<<b<<endl;
    }
    return;
}


int main() {
    ll T=1;
    while (T--){
        solve();
    }
    return 0;
}
0