結果

問題 No.1727 [Cherry 3rd Tune] Stray
ユーザー 👑 kakel-sankakel-san
提出日時 2021-10-30 15:28:01
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 127 ms / 6,000 ms
コード長 1,938 bytes
コンパイル時間 2,152 ms
コンパイル使用メモリ 106,880 KB
実行使用メモリ 23,424 KB
最終ジャッジ日時 2024-04-16 16:22:43
合計ジャッジ時間 2,386 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
19,072 KB
testcase_01 AC 27 ms
19,072 KB
testcase_02 AC 28 ms
19,200 KB
testcase_03 AC 28 ms
19,072 KB
testcase_04 AC 29 ms
19,328 KB
testcase_05 AC 34 ms
19,456 KB
testcase_06 AC 51 ms
20,504 KB
testcase_07 AC 127 ms
23,424 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 static System.Console;
using System.Linq;

class yuki320
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(int n) => Enumerable.Repeat(0, n).Select(_ => NList).ToArray();
    static void Main()
    {
        var t = NN;
        var c = NList;
        var n = c[0];
        var bitmax = 1 << 2 * n;
        var used = new bool[bitmax];
        var res = 0;
        for (var b = 0; b < bitmax; ++b)
        {
            if (used[b]) continue;
            var list = List(n * 2, b);
            for (var i = 0; i < n; ++i)
            {
                Shift(list);
                used[Val(list)] = true;
            }
            Array.Reverse(list);
            for (var i = 0; i < n; ++i)
            {
                Shift(list);
                used[Val(list)] = true;
            }
            ++res;
        }
        WriteLine(res);
    }
    static int[] List(int n, int b)
    {
        var list = new int[n];
        var tmp = b;
        for (var i = list.Length - 1; i >= 0; --i)
        {
            list[i] = tmp % 2;
            tmp >>= 1;
        }
        return list;
    }
    static int Val(int[] list)
    {
        var res = 0;
        for (var i = list.Length - 1;  i >= 0; --i)
        {
            res <<= 1;
            res += list[i];
        }
        return res;
    }
    static void Shift(int[] list)
    {
        var tmp = list[0];
        for (var i = 0; i < list.Length / 2 - 1; ++i)
        {
            list[i] = list[i + 1];
        }
        list[list.Length / 2 - 1] = tmp;
        tmp = list[list.Length / 2];
        for (var i = list.Length / 2; i < list.Length - 1; ++i)
        {
            list[i] = list[i + 1];
        }
        list[list.Length - 1] = tmp;
    }
}
0