結果

問題 No.1366 交換門松列・梅
ユーザー CleyLCleyL
提出日時 2021-10-18 17:30:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 617 bytes
コンパイル時間 680 ms
コンパイル使用メモリ 69,116 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 10:36:59
合計ジャッジ時間 1,222 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 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 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 <iostream>
#include <vector>
using namespace std;
bool isKadomatsu(int a,int b,int c){
    if(a == b || a == c || b == c)return false;
    return ((b<a && b<c) || (b>a && b>c));
}
int main(){
    vector<int> A(6);
    for(int i = 0; 6 > i; i++){
        cin>>A[i];
    }
    for(int i = 0; 3 > i; i++){
        for(int j = 3; 6 > j; j++){
            swap(A[i],A[j]);
            if(isKadomatsu(A[0],A[1],A[2]) && isKadomatsu(A[3],A[4],A[5])){
                cout << "Yes" << endl;
                return 0;
            }
            
            swap(A[i],A[j]);
        }
    }
    cout << "No" << endl;
}
0