結果

問題 No.1366 交換門松列・梅
ユーザー firiexp
提出日時 2021-04-27 15:09:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 969 bytes
コンパイル時間 841 ms
コンパイル使用メモリ 101,192 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-20 11:02:23
合計ジャッジ時間 1,433 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:25:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   25 |     for (auto &&i : a) scanf("%d", &i);
      |                        ~~~~~^~~~~~~~~~
main.cpp:26:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   26 |     for (auto &&i : b) scanf("%d", &i);
      |                        ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

bool IsKadomatsu(int a, int b, int c){
    if(a == b || b == c || c == a) return false;
    return max({a, b, c}) == b || min({a, b, c}) == b;
}
int main() {
    vector<int> a(3), b(3);
    for (auto &&i : a) scanf("%d", &i);
    for (auto &&i : b) scanf("%d", &i);
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            swap(a[i], b[j]);

            if(IsKadomatsu(a[0], a[1], a[2]) && IsKadomatsu(b[0], b[1], b[2])){
                puts("Yes");
                return 0;
            }
            swap(a[i], b[j]);
        }
    }
    puts("No");
    return 0;
}
0