結果

問題 No.1366 交換門松列・梅
ユーザー weakenweaken
提出日時 2021-05-18 05:44:43
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 945 bytes
コンパイル時間 2,234 ms
コンパイル使用メモリ 196,776 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 19:54:27
合計ジャッジ時間 2,576 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define FastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

bool IsKadomatsu(vector<int> a) {
  if (a[0] == a[1] || a[1] == a[2] || a[0] == a[2]) return false;
  return (a[0] < a[1] && a[1] > a[2]) || (a[0] > a[1] && a[1] < a[2]);
}

void Trace(vector<int> ai) {
  for (const auto a : ai) cout << a;
  cout << '\n';
}

void solve() {
  vector<int> ai(3), bi(3);
  for (auto &a : ai) cin >> a;
  for (auto &b : bi) cin >> b;

  for (int i = 0; i < 3; i++) {
    vector<int> A = ai, B = bi;
    for (int j = 0; j < 3; j++) {
      auto tmp = A[i];
      A[i] = B[j];
      B[j] = tmp;

      // Trace(A);
      // Trace(B);

      if (IsKadomatsu(A) == true && IsKadomatsu(B) == true) {
        cout << "Yes" << '\n';
        return;
      }
    }
  }
  cout << "No" << '\n';
  return;
}

int main() {
  FastIO;
  solve();
  return 0;
}
0