結果

問題 No.1820 NandShift
ユーザー 👑 NachiaNachia
提出日時 2022-01-21 23:27:33
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,424 bytes
コンパイル時間 772 ms
コンパイル使用メモリ 89,420 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-17 08:12:57
合計ジャッジ時間 2,353 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
using i32 = int;
using u32 = unsigned int;
#define rep(i,n) for(int i=0; i<(n); i++)


bool is_piriodic(const string& s, int k){
    int n = s.size();
    for(int i=0; i<n; i++) if(s[i] != s[(i+k)%n]) return false;
    return true;
}



int main() {
    int N,M; cin >> N >> M;
    string X; cin >> X;
    vector<string> A(N);
    rep(i,N) cin >> A[i];

    vector<vector<int>> ans;

    auto query_shift = [&](int o, int i) -> void {
        ans.push_back({ 1, o, i });
    };
    auto query_nand = [&](int o, int a, int b) -> void {
        ans.push_back({ 2, o, a, b });
    };

    query_nand(0,0,0);

    reverse(X.begin(), X.end());

    int Z = 7001;
    query_nand(Z,Z,Z);
    query_shift(Z,Z);
    rep(i,M){
        if(X[i] == '1'){
            query_nand(0,0,Z);
            query_nand(0,0,0);
        }
        query_nand(Z,Z,Z);
        query_shift(Z,Z);
        query_nand(Z,Z,Z);
    }
    query_nand(0,0,0);

    cout << ans.size() << "\n";
    for(auto& a : ans){
        rep(i,a.size()){
            if(i) cout << " ";
            cout << a[i];
        }
        cout << "\n";
    }

    return 0;
}



struct ios_do_not_sync{
    ios_do_not_sync(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(nullptr);
    }
} ios_do_not_sync_instance;
0