結果

問題 No.792 真理関数をつくろう
ユーザー pyraninepyranine
提出日時 2020-12-20 10:29:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,590 bytes
コンパイル時間 1,747 ms
コンパイル使用メモリ 170,912 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 10:28:58
合計ジャッジ時間 3,507 ms
ジャッジサーバーID
(参考情報)
judge12 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

using i8 = int8_t;using i16 = int16_t;using i32 = int32_t;using i64 = int64_t;using i128 = __int128_t;using u8 = uint8_t;using u16 = uint16_t;using u32 = uint32_t;using u64 = uint64_t;using u128 = __uint128_t;using f32 = float;using f64 = double;using f80 = long double;
using vi32 = vector<i32>;using vi64 = vector<i64>;using vu32 = vector<u32>;using vu64 = vector<u64>;
using vvi32 = vector<vector<int32_t>>;using vvi64 = vector<vector<int64_t>>;using vvu32 = vector<vector<uint32_t>>;using vvu64 = vector<vector<uint64_t>>;
using pi32 = pair<i32,i32>;using pi64 = pair<i64,i64>;using pu32 = pair<u32,u32>;using pu64 = pair<u64,u64>;
using vpi32 = vector<pi32>;using vpi64 = vector<pi64>;using vpu32 = vector<pu32>;using vpu64 = vector<pu64>;

const i64 Mod = 1e9+7;

int main() {
  int n;
  cin >> n;
  int check_t = true;
  int check_f = false;
  string res;
  for (int i = 0; i < 1 << n; i++) {
    vi32 vec(n);
    for (int j = 0; j < n; j++) cin >> vec[i];
    int r;
    cin >> r;
    if (!r) {
      check_t = false;
      continue;
    }
    check_f = false;
    if (!res.empty()) res += "∨";
    res += '(';
    for (int j = 0; j < n; j++) {
      if (i) res += "∧";
      if (vec[i]) {
        res += "P_";
        res += to_string(i + 1);
      }
      else {
        res += "¬P_";
        res += to_string(i + 1);
      }
    }
    res += ')';
  }
  cout << "A=";
  if (check_t) {
    cout << "⊤" << '\n';
    return 0;
  }
  if (check_f) {
    cout << "⊥" << '\n';
    return 0;
  }
  cout << res << '\n';
  return 0;
}
0