提出 #29452987


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > list_up(int x, int y){
  set<pair<int, int> > L;
  L.insert(make_pair(x-2, y+1));
  L.insert(make_pair(x-2, y-1));
  L.insert(make_pair(x+2, y+1));
  L.insert(make_pair(x+2, y-1));
  L.insert(make_pair(x-1, y+2));
  L.insert(make_pair(x-1, y-2));
  L.insert(make_pair(x+1, y+2));
  L.insert(make_pair(x+1, y-2));
  return L;
}

int main() {
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  
  auto l1 = list_up(x1, y1);
  auto l2 = list_up(x2, y2);
  
  bool f = false;
  for (int i=0; i<8; i++){
    pair<int, int> p = *begin(l1);
    f = (f || l2.count(p));
    l1.erase(p);
  }
  
  cout << (f ? "Yes" : "No") << endl;
  return 0;
}

提出情報

提出日時
問題 C - Knight Fork
ユーザ nullpoint
言語 C++ (GCC 9.2.1)
得点 300
コード長 741 Byte
結果 AC
実行時間 8 ms
メモリ 3628 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 20
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 02_min_00.txt, 03_yes_00.txt, 03_yes_01.txt, 03_yes_02.txt, 03_yes_03.txt, 03_yes_04.txt, 03_yes_05.txt, 03_yes_06.txt, 03_yes_07.txt, 04_near_00.txt, 04_near_01.txt, 04_near_02.txt, 04_near_03.txt, 04_near_04.txt, 04_near_05.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 8 ms 3592 KiB
00_sample_01.txt AC 2 ms 3592 KiB
00_sample_02.txt AC 2 ms 3480 KiB
01_random_00.txt AC 2 ms 3616 KiB
01_random_01.txt AC 2 ms 3536 KiB
02_min_00.txt AC 2 ms 3600 KiB
03_yes_00.txt AC 2 ms 3416 KiB
03_yes_01.txt AC 3 ms 3612 KiB
03_yes_02.txt AC 2 ms 3596 KiB
03_yes_03.txt AC 2 ms 3592 KiB
03_yes_04.txt AC 2 ms 3560 KiB
03_yes_05.txt AC 2 ms 3480 KiB
03_yes_06.txt AC 5 ms 3612 KiB
03_yes_07.txt AC 2 ms 3560 KiB
04_near_00.txt AC 2 ms 3588 KiB
04_near_01.txt AC 2 ms 3628 KiB
04_near_02.txt AC 2 ms 3476 KiB
04_near_03.txt AC 2 ms 3420 KiB
04_near_04.txt AC 2 ms 3588 KiB
04_near_05.txt AC 2 ms 3596 KiB