結果
問題 | No.2121 帰属関係と充足可能性 |
ユーザー | 沙耶花 |
提出日時 | 2022-11-04 22:43:54 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,039 bytes |
コンパイル時間 | 4,540 ms |
コンパイル使用メモリ | 266,868 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 20:40:46 |
合計ジャッジ時間 | 6,155 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 43 RE * 6 |
ソースコード
#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 { assert(false); if(a[0]!=a[1] && !D.same(a[0],a[1]))cout<<"NO"<<endl; else cout<<"YES"<<endl; } } return 0; }