結果

問題 No.1366 交換門松列・梅
ユーザー ManjushriMitra
提出日時 2025-03-16 16:32:09
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,289 bytes
コンパイル時間 2,792 ms
コンパイル使用メモリ 278,824 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-20 11:30:51
合計ジャッジ時間 3,502 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,m,n) for(int i=m; i<int(n); ++i)
#define repll(i,m,n) for(ll i=m; i<ll(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define leng(a) int(a.size())
#define fi first
#define se second

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

template<typename T> T gcd(T a, T b){ return a % b ? gcd(b, a % b) : b; }
template<typename T> T lcm(T a, T b){ return a / gcd(a, b) * b; }

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    vector<int> a(3), b(3);
    rep(i, 0, 3) cin >> a[i];
    rep(i, 0, 3) cin >> b[i];

    rep(i, 0, 3) rep(j, 0, 3){
        auto a2 = a, b2 = b;
        swap(a2[i], b2[j]);
        if(is_kado(a2) && is_kado(b2)){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}
0