結果
| 問題 |
No.792 真理関数をつくろう
|
| コンテスト | |
| ユーザー |
chocorusk
|
| 提出日時 | 2019-02-22 22:00:31 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,229 bytes |
| コンパイル時間 | 803 ms |
| コンパイル使用メモリ | 98,284 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-25 08:22:48 |
| 合計ジャッジ時間 | 1,672 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | WA * 22 |
コンパイルメッセージ
main.cpp:47:33: warning: multi-character character constant [-Wmultichar]
47 | if(q[i][j]==0) ans+='¬';
| ^~~
main.cpp:50:28: warning: multi-character character constant [-Wmultichar]
50 | if(j<n-1) ans+='∧';
| ^~~
main.cpp:53:14: warning: multi-character character constant [-Wmultichar]
53 | ans+='∨';
| ^~~
main.cpp: In function ‘int main()’:
main.cpp:47:33: warning: overflow in conversion from ‘int’ to ‘char’ changes value from ‘49836’ to ‘'\37777777654'’ [-Woverflow]
47 | if(q[i][j]==0) ans+='¬';
| ^~~
main.cpp:50:28: warning: overflow in conversion from ‘int’ to ‘char’ changes value from ‘14846119’ to ‘'\37777777647'’ [-Woverflow]
50 | if(j<n-1) ans+='∧';
| ^~~
main.cpp:53:14: warning: overflow in conversion from ‘int’ to ‘char’ changes value from ‘14846120’ to ‘'\37777777650'’ [-Woverflow]
53 | ans+='∨';
| ^~~
ソースコード
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
string num[12]={"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"};
int main()
{
int n; cin>>n;
int q[1<<12][12], r[1<<12];
bool all=1, nall=1;
for(int i=0; i<(1<<n); i++){
for(int j=0; j<n; j++){
cin>>q[i][j];
}
cin>>r[i];
if(r[i]) nall=0;
else all=0;
}
if(all){
cout<<"A=⊤"<<endl;
return 0;
}else if(nall){
cout<<"A=⊥"<<endl;
return 0;
}
string ans;
for(int i=0; i<(1<<n); i++){
if(r[i]==0) continue;
ans+='(';
for(int j=0; j<n; j++){
if(q[i][j]==0) ans+='¬';
ans+="P_";
ans+=num[j];
if(j<n-1) ans+='∧';
else ans+=')';
}
ans+='∨';
}
ans.pop_back();
cout<<ans<<endl;
return 0;
}
chocorusk