結果

問題 No.1366 交換門松列・梅
ユーザー kobakoba_issakobakoba_issa
提出日時 2021-01-30 00:08:20
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,203 bytes
コンパイル時間 1,340 ms
コンパイル使用メモリ 141,728 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-17 10:32:06
合計ジャッジ時間 1,905 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>
#include <ctype.h>

using namespace std;

typedef long long ll;

const int INF = (1<<30)-1;
const ll LINF = 1e18;

#define rep(i, n) for (int i = 0; i < n; i++)

template<class T> 
bool chmax(T &a, T b) {if (a < b) {a = b;return true;}else return false;}

template<class T> 
bool chmin(T &a, T b) {if (a > b) {a = b;return true;}else return false;}

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

int main() {
    vector<int> a(3), b(3);
    rep(i, 3)   cin >> a[i];
    rep(i, 3)   cin >> b[i];
    rep(i, 3)rep(j, 3) {
        swap(a[i], b[j]);
        if (func(a) && func(b)) {
            cout << "Yes" << endl;
            return 0;
        }
        swap(a[i], b[j]);
    }
    cout << "No" << endl;
    return 0;
}

//小数点精度
//cout << fixed << std::setprecision(15) << y << endl;
0