結果

問題 No.1589 Bit Vector
ユーザー SSRS
提出日時 2021-07-08 23:41:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 785 bytes
コンパイル時間 1,663 ms
コンパイル使用メモリ 176,956 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-01 13:18:11
合計ジャッジ時間 3,561 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, K;
  cin >> N >> K;
  vector<tuple<string, int, int, int>> op;
  for (int i = 0; i < N; i++){
    for (int j = N - 2; j >= i; j--){
      int a = j, b = j + 1;
      op.push_back(make_tuple("XOR", N, a, b));
      op.push_back(make_tuple("AND", b, a, b));
      op.push_back(make_tuple("XOR", a, b, N));
    }
  }
  op.push_back(make_tuple("AND", N, K - 1, K - 1));
  int cnt = op.size();
  cout << cnt << endl;
  for (int i = 0; i < cnt; i++){
    if (get<0>(op[i]) == "AND"){
      cout << "AND " << get<1>(op[i]) << ' ' << get<2>(op[i]) << ' ' << get<3>(op[i]) << endl;
    }
    if (get<0>(op[i]) == "XOR"){
      cout << "XOR " << get<1>(op[i]) << ' ' << get<2>(op[i]) << ' ' << get<3>(op[i]) << endl;
    }
  }
}
0