結果
| 問題 |
No.2121 帰属関係と充足可能性
|
| コンテスト | |
| ユーザー |
milanis48663220
|
| 提出日時 | 2022-11-04 23:19:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 2,000 ms |
| コード長 | 2,548 bytes |
| コンパイル時間 | 1,208 ms |
| コンパイル使用メモリ | 116,304 KB |
| 最終ジャッジ日時 | 2025-02-08 18:21:32 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 49 |
コンパイルメッセージ
main.cpp: In lambda function:
main.cpp:65:5: warning: control reaches end of non-void function [-Wreturn-type]
65 | }();
| ^
ソースコード
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cmath>
#include <numeric>
#include <functional>
#include <cassert>
#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
template<typename T>
vector<vector<T>> vec2d(int n, int m, T v){
return vector<vector<T>>(n, vector<T>(m, v));
}
template<typename T>
vector<vector<vector<T>>> vec3d(int n, int m, int k, T v){
return vector<vector<vector<T>>>(n, vector<vector<T>>(m, vector<T>(k, v)));
}
template<typename T>
void print_vector(vector<T> v, char delimiter=' '){
if(v.empty()) {
cout << endl;
return;
}
for(int i = 0; i+1 < v.size(); i++) cout << v[i] << delimiter;
cout << v.back() << endl;
}
vector<int> vv = {1, 3, 4, 5};
vector<int> uu = {2, 2, 2, 0};
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout << setprecision(10) << fixed;
int n; cin >> n;
vector<int> a(6);
for(int i = 0; i < 6; i++) cin >> a[i];
if(n == 0){
cout << "NO" << endl;
return 0;
}
int mx = [&](){
if(n == 0) return -1;
if(n == 1) return 0;
if(n == 2) return 1;
if(n == 3) return 3;
if(n == 4) return 15;
if(n == 5) return (1<<16)-1;
}();
for(int x = 0; x <= 15; x++){
for(int y = 0; y <= 15; y++){
for(int z = 0; z <= 15; z++){
if(max({x, y, z}) > mx) continue;
vector<int> v = {x, y, z};
auto ok = [&](){
vector<int> b(6);
for(int i = 0; i < 6; i++) b[i] = v[a[i]];
if((b[0]&b[1]) != b[0]) return false;
for(int i = 0; i < 4; i++){
int j = vv[i];
int k = uu[i];
if((b[k]&(1<<b[j])) == 0) return false;
}
return true;
};
if(ok()){
cout << "YES" << endl;
return 0;
}
}
}
}
cout << "NO" << endl;
}
milanis48663220