結果

問題 No.1366 交換門松列・梅
ユーザー bluemegane
提出日時 2021-01-30 07:06:46
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 24 ms / 1,000 ms
コード長 994 bytes
コンパイル時間 911 ms
コンパイル使用メモリ 111,852 KB
実行使用メモリ 24,492 KB
最終ジャッジ日時 2025-06-20 10:57:58
合計ジャッジ時間 1,753 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Hello
{
    public static int[] a, b;
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        a = Array.ConvertAll(line, int.Parse);
        line = Console.ReadLine().Trim().Split(' ');
        b = Array.ConvertAll(line, int.Parse);
        getAns();
    }
    static void getAns()
    {
        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++)
            {
                swap(i, j);
                if (check(a) && check(b)) { Console.WriteLine("Yes"); return; }
                swap(i, j);
            }
        Console.WriteLine("No");
    }
    static void swap(int i, int j)
    {
        var w = a[i];
        a[i] = b[j];
        b[j] = w;
    }
    static bool check(int[] a)
    {
        if (!(a[0] != a[1] && a[1] != a[2] && a[0] != a[2])) return false;
        if (a[1] > a[0] && a[1] > a[2]) return true;
        if (a[1] < a[0] && a[1] < a[2]) return true;
        return false;
    }
}
0