結果
問題 |
No.870 無敵囲い
|
ユーザー |
![]() |
提出日時 | 2019-10-01 17:59:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 300 ms |
コード長 | 1,326 bytes |
コンパイル時間 | 820 ms |
コンパイル使用メモリ | 97,132 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 06:25:53 |
合計ジャッジ時間 | 1,573 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<map> #include<set> #include<cstdio> #include<cmath> #include<numeric> #include<queue> #include<stack> #include<cstring> #include<limits> #include<functional> #include<unordered_set> #define rep(i,a) for(int i=(int)0;i<(int)a;++i) #define pb push_back #define eb emplace_back using ll=long long; constexpr ll mod = 1e9 + 7; constexpr ll INF = 1LL << 50; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } using namespace std; void solve(){ int n; cin>>n; pair<int,int>a=make_pair(2,8),b=make_pair(3,9),c=make_pair(7,9); vector<pair<int,int>>cd1(n),cd2(n); rep(i,n){ int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2; cd1[i]=make_pair(x1,y1);cd2[i]=make_pair(x2,y2); } rep(i,n){ if(cd1[i]==a)a=cd2[i]; else if(cd1[i]==b)b=cd2[i]; else if(cd1[i]==c)c=cd2[i]; } if(a.first==5&&a.second==8&&b.first==4&&b.second==8&&c.first==6&&c.second==8)cout<<"YES\n"; else cout<<"NO\n"; } signed main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); solve(); return 0; }