結果

問題 No.3211 NAND Oracle
ユーザー t98slider
提出日時 2025-07-25 21:38:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 845 bytes
コンパイル時間 1,491 ms
コンパイル使用メモリ 195,500 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-07-25 21:38:39
合計ジャッジ時間 4,565 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

    auto check = [&](int s, int t){
        vector<int> a(2 + Q);
        a[0] = s, a[1] = t;
        for(int i = 0; i < Q; i++){
            if(i % 4 <= 1){
                a[i + 2] = !(a[0] & a[1]);
            }else{
                a[i + 2] = !(a[2] & a[3]);
            }
        }
        return accumulate(a.begin(), a.end(), 0) <= K;
    };
    for(int i = 0; i < 4; i++){
        if(!check(i >> 1 & 1, i & 1)){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    for(int i = 0; i < Q; i++){
        if(i % 4 <= 1){
            cout << 1 << ' ' << 2 << '\n';
        }else{
            cout << 3 << ' ' << 4 << '\n';
        }
    }
}
0