結果

問題 No.26 シャッフルゲーム
ユーザー TaK7907TaK7907
提出日時 2017-10-28 05:07:24
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,564 bytes
コンパイル時間 3,528 ms
コンパイル使用メモリ 112,052 KB
実行使用メモリ 27,264 KB
最終ジャッジ日時 2024-05-01 18:57:06
合計ジャッジ時間 1,952 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 27 ms
19,072 KB
testcase_02 WA -
testcase_03 AC 26 ms
18,944 KB
testcase_04 AC 27 ms
19,200 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 26 ms
19,200 KB
testcase_09 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

namespace yukicodeX {
    public class Program {
        public static int Solver(System.IO.TextReader reader) {
            var n =1 << (3-int.Parse( reader.ReadLine()));
            var m = int.Parse( reader.ReadLine() );
            for (var i = 0; i != m; ++i) {
                var p = MyLib.GetIntList( reader.ReadLine() );
                var nn = n & ( p[ 0 ] | p[ 1 ] );
                if (nn > 0) n = n ^ ( p[ 0 ] | p[ 1 ] );
            }
            return (int)(3 - Math.Log( n ) / Math.Log( 2 ));
        }

        private static void Main() {
            Console.WriteLine( Solver( Console.In ) );
        }
    }

    public class MyLib {
        public static string Ordinalization(int num) {
            string surfix = "stndrdth";
            return string.Format( "{0}{1}", num,
                ( 0 < num % 10 && num % 10 <= 4 ) && ( ( num % 100 ) / 10 != 1 ) ?
                surfix.Substring( ( num % 10 - 1 ) * 2, 2 ) : surfix.Substring( 6 ) );
        }

        public static List<int> GetIntList(string input) {
            return input.Split().ToList<string>().ConvertAll<int>( int.Parse );
        }

        public static List<int> GetIntList(string input, char delimitor) {
            return input.Split( delimitor ).ToList<string>().ConvertAll<int>( int.Parse );
        }

        public static List<int> GetIntList(string input, char[] delimitors) {
            return input.Split( delimitors ).ToList<string>().ConvertAll<int>( int.Parse );
        }
    }
}
0