結果

問題 No.1366 交換門松列・梅
ユーザー traindoggo
提出日時 2024-02-06 13:57:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,412 bytes
コンパイル時間 2,007 ms
コンパイル使用メモリ 194,384 KB
最終ジャッジ日時 2025-02-19 02:19:32
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG_
#include <compe/debug.hpp>
#else
#define dump(...)
#endif

#define FastIO cin.tie(nullptr), ios_base::sync_with_stdio(false);
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define output(msg) cout << (msg) << '\n'
#define die(msg)         \
  do {                   \
    cout << msg << endl; \
    exit(0);             \
  } while (0)
#define all(k) k.begin(), k.end()
#define rall(k) k.rbegin(), k.rend()
#define INFi 1 << 30
#define INFll 1LL << 60

template <typename T> bool chmax(T& a, const T& b) {
  return ((a < b) ? (a = b, true) : (false));
}
template <typename T> bool chmin(T& a, const T& b) {
  return ((a > b) ? (a = b, true) : false);
}

using llint = long long int;

bool is_kadomatsu(vector<int> ai, vector<int> bi, int a, int b) {
  int tmp = ai[a];
  ai[a] = bi[b];
  bi[b] = tmp;

  if (ai[1] < ai[0] && ai[0] < ai[2]) return true;
  if (ai[1] < ai[2] && ai[2] < ai[0]) return true;
  if (ai[1] > ai[0] && ai[0] > ai[2]) return true;
  if (ai[1] > ai[2] && ai[2] > ai[0]) return true;

  return false;
}

int main() {
  FastIO;
  vector<int> ai(3), bi(3);
  rep(i, 3) cin >> ai[i];
  rep(i, 3) cin >> bi[i];

  bool can_kadomatsu{false};
  rep(i, 3) {
    rep(j, 3) {
      if (is_kadomatsu(ai, bi, i, j)) {
        can_kadomatsu = true;
      }
    }
  }
  if (can_kadomatsu)
    output("Yes");
  else
    output("No");
}
0