結果
| 問題 |
No.792 真理関数をつくろう
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-03-02 08:21:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 927 bytes |
| コンパイル時間 | 1,635 ms |
| コンパイル使用メモリ | 172,260 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-23 12:16:32 |
| 合計ジャッジ時間 | 2,440 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 11 WA * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
bool isTop = true;
bool isBottom = true;
string ans = "A=";
int loop = n * n;
if(n == 1) loop = 2;
bool existPre = false;
for(int i=0; i<loop; i++){
vector<int> v(n+1);
for(int j=0; j<=n; j++){
cin >> v[j];
}
if(v[n] == 1){
isBottom = false;
if(existPre) ans += "∨";
existPre = true;
ans += "(";
for(int j=0; j<n; j++){
if(v[j] == 1) ans += ("P_" + to_string(j+1));
else if(v[j] == 0) ans += ("¬P_" + to_string(j+1));
if(j != n-1) ans += "∧";
}
ans += ")";
}
else isTop = false;
}
if(isTop) cout << "A=⊤" << endl;
else if(isBottom) cout << "A=⊥" << endl;
else cout << ans << endl;
return 0;
}