結果
問題 | No.870 無敵囲い |
ユーザー |
![]() |
提出日時 | 2019-09-22 19:04:05 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 300 ms |
コード長 | 814 bytes |
コンパイル時間 | 1,319 ms |
コンパイル使用メモリ | 160,984 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 06:25:23 |
合計ジャッジ時間 | 1,962 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h>using namespace std;using pii = pair<int, int>;vector<pii> pos = {make_pair(2, 8), make_pair(3, 9), make_pair(7, 9)};int main() {ios::sync_with_stdio(false);cin.tie(0);int N;cin >> N;vector<pii> from(N), to(N);for (int i = 0; i < N; i++) {int x, y;cin >> x >> y;from[i] = make_pair(x, y);cin >> x >> y;to[i] = make_pair(x, y);}for (int i = 0; i < N; i++) {for (int j = 0; j < 3; j++) {if (pos[j].first == from[i].first && pos[j].second == from[i].second) {pos[j] = to[i];}}}if (pos[0].first == 5 && pos[0].second == 8 && pos[1].first == 4 &&pos[1].second == 8 && pos[2].first == 6 && pos[2].second == 8) {cout << "YES" << '\n';} else {cout << "NO" << '\n';}return 0;}