結果

問題 No.1366 交換門松列・梅
ユーザー noritakenoritake
提出日時 2021-01-29 21:49:52
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,833 bytes
コンパイル時間 1,628 ms
コンパイル使用メモリ 166,272 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 10:29:53
合計ジャッジ時間 2,175 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
// #include <atcoder/all> // NOTE: AtCoderライブラリ
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl;
#define dbg3(x, y, z) cerr << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;
#define nl() cout << "========================================" << endl;
using namespace std;
// using namespace atcoder; // NOTE: AtCoderライブラリ
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<vector<long long>> vvl;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
const long long LINF = 1001002003004005006ll;
const int INF = 1001001001;
template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }
#define yn { puts("Yes"); } else{ puts("No"); } // 使い方: if (条件) yn; 

bool f(vi x) {
    if (x[0] == x[1] || x[1] == x[2] || x[0] == x[2]) return false;

    int xmax = *max_element(x.begin(), x.end());
    int xmin = *min_element(x.begin(), x.end());
    
    if (x[1] == xmax || x[1] == xmin) return true;
    else return false;
}

int main() {
    vi A(3); rep(i, 3) cin >> A[i];
    vi B(3); rep(i, 3) cin >> B[i];

    rep(i, 3) {
        rep(j, 3) {
            vi A2 = A;
            vi B2 = B;

            swap(A2[i], B2[j]);
            bool ok = f(A2);
            ok = f(B2) && ok;

            if (ok) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
}
0