結果

問題 No.2212 One XOR Matrix
ユーザー 👑 kakel-sankakel-san
提出日時 2023-10-17 23:40:08
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 241 ms / 2,000 ms
コード長 1,443 bytes
コンパイル時間 16,708 ms
コンパイル使用メモリ 160,244 KB
実行使用メモリ 251,176 KB
最終ジャッジ日時 2023-10-17 23:40:33
合計ジャッジ時間 22,466 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
32,288 KB
testcase_01 AC 76 ms
31,552 KB
testcase_02 AC 80 ms
32,284 KB
testcase_03 AC 83 ms
32,484 KB
testcase_04 AC 80 ms
32,540 KB
testcase_05 AC 81 ms
32,824 KB
testcase_06 AC 83 ms
33,852 KB
testcase_07 AC 95 ms
38,456 KB
testcase_08 AC 135 ms
54,592 KB
testcase_09 AC 241 ms
251,176 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (104 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        if (n == 1)
        {
            WriteLine(-1);
            return;
        }
        var a = new int[][] { new int[] { 0, 3 }, new int[] { 2, 1 } };
        for (var i = 0; i < n - 1; ++i)
        {
            a = Double(a);
        }
        for (var i = 0; i < a.Length; i += 2)
        {
            (a[i][a.Length - i - 1], a[i + 1][a.Length - i - 2]) = (a[i + 1][a.Length - i - 2], a[i][a.Length - i - 1]);
        }
        WriteLine(string.Join("\n", a.Select(ai => string.Join(" ", ai))));
    }
    static int[][] Double(int[][] a)
    {
        var ans = new int[a.Length * 2][];
        for (var i = 0; i < ans.Length; ++i) ans[i] = new int[a.Length * 2];
        for (var i = 0; i < a.Length; ++i) for (var j = 0; j < a[i].Length; ++j)
        {
            ans[i][j] = a[i][j];
            ans[i + a.Length][j + a.Length] = a[i][j] + a.Length * a.Length;
            ans[i + a.Length][j] = a[i][j] + a.Length * a.Length * 2;
            ans[i][j + a.Length] = a[i][j] + a.Length * a.Length * 3;
        }
        return ans;
    }
}
0