結果
問題 | No.870 無敵囲い |
ユーザー |
|
提出日時 | 2019-08-30 21:57:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 300 ms |
コード長 | 1,419 bytes |
コンパイル時間 | 1,654 ms |
コンパイル使用メモリ | 175,104 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-29 06:18:01 |
合計ジャッジ時間 | 2,163 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
/**@file 870.cpp@title No.870 無敵囲い - yukicoder@url https://yukicoder.me/problems/no/870**/#include <bits/stdc++.h>using namespace std;typedef long long LL;#define ALL(obj) (obj).begin(), (obj).end()#define REP(i, N) for (int i = 0; i < (N); ++i)int main() {int N;cin >> N;vector<string> xy(N, "");string tmp0, tmp1, tmp2, tmp3;REP(i, N) {cin >> tmp0 >> tmp1 >> tmp2 >> tmp3;xy[i] = tmp0 + tmp1 + tmp2 + tmp3;}// vector<vector<pair<bool, string>>> grid(9, vector<pair<bool, string>>(9));pair<bool, string> grid[10][10];REP(i, 10) {REP(j, 10) {grid[i][j].first = false;grid[i][j].second = "";}}grid[2][8].first = true;grid[2][8].second = "A";grid[3][9].first = true;grid[3][9].second = "B";grid[7][9].first = true;grid[7][9].second = "C";REP(i, N) {int x1 = stoi(xy[i].substr(0, 1));int y1 = stoi(xy[i].substr(1, 1));int x2 = stoi(xy[i].substr(2, 1));int y2 = stoi(xy[i].substr(3, 1));grid[x1][y1].first = false;grid[x2][y2].first = true;grid[x2][y2].second = grid[x1][y1].second;grid[x1][y1].second = "";}if (grid[5][8].first && grid[5][8].second == "A"&& grid[4][8].first && grid[4][8].second == "B"&& grid[6][8].first && grid[6][8].second == "C") {cout << "YES" << endl;} else {cout << "NO" << endl;}return 0;}