結果
| 問題 |
No.2121 帰属関係と充足可能性
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2022-11-04 22:41:28 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,021 bytes |
| コンパイル時間 | 4,327 ms |
| コンパイル使用メモリ | 257,496 KB |
| 最終ジャッジ日時 | 2025-02-08 18:08:17 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 48 WA * 1 |
ソースコード
#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001
vector<vector<string>> s(6);
int main(){
s[0] = {};
int n;
cin>>n;
if(n<=1){
cout<<"NO"<<endl;
return 0;
}
vector<int> a(6);
rep(i,6)cin>>a[i];
vector<int> t = {0,1,2};
bool F = false;
vector<int> xx = {1,3,4,5},yy = {2,2,2,0};
do{
bool f = true;
rep(i,4){
int x = xx[i];
int y = yy[i];
if(t[a[x]]>=t[a[y]]){
f= false;
break;
}
}
if(f)F = true;
}
while(next_permutation(t.begin(),t.end()));
if(!F)cout<<"NO"<<endl;
else{
dsu D(3);
rep(i,xx.size()){
if(i==0)continue;
D.merge(a[xx[i]],a[yy[i]]);
}
int m = 0;
rep(i,3){
m = max(m,D.size(i));
}
if(n==2&&m==3)cout<<"NO"<<endl;
else {
if(a[0]!=a[1] && !D.same(a[0],a[1]))cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
}
return 0;
}
沙耶花