結果

問題 No.2209 Flip and Reverse
ユーザー 👑 kakel-sankakel-san
提出日時 2023-02-18 20:40:04
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 985 bytes
コンパイル時間 974 ms
コンパイル使用メモリ 68,468 KB
実行使用メモリ 35,072 KB
最終ジャッジ日時 2023-09-27 10:23:08
合計ジャッジ時間 7,701 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
21,444 KB
testcase_01 AC 57 ms
21,540 KB
testcase_02 AC 59 ms
23,656 KB
testcase_03 AC 59 ms
21,664 KB
testcase_04 AC 59 ms
23,604 KB
testcase_05 AC 59 ms
21,484 KB
testcase_06 AC 60 ms
23,500 KB
testcase_07 AC 59 ms
21,636 KB
testcase_08 AC 102 ms
32,888 KB
testcase_09 AC 58 ms
19,344 KB
testcase_10 AC 58 ms
21,420 KB
testcase_11 AC 59 ms
21,532 KB
testcase_12 AC 59 ms
23,548 KB
testcase_13 AC 59 ms
21,428 KB
testcase_14 AC 113 ms
34,884 KB
testcase_15 AC 111 ms
34,876 KB
testcase_16 AC 112 ms
32,880 KB
testcase_17 AC 111 ms
31,004 KB
testcase_18 AC 110 ms
32,996 KB
testcase_19 AC 109 ms
32,956 KB
testcase_20 AC 111 ms
32,832 KB
testcase_21 AC 110 ms
32,928 KB
testcase_22 AC 113 ms
34,984 KB
testcase_23 AC 112 ms
32,828 KB
testcase_24 AC 107 ms
34,940 KB
testcase_25 AC 106 ms
32,948 KB
testcase_26 AC 108 ms
34,892 KB
testcase_27 AC 107 ms
32,844 KB
testcase_28 AC 101 ms
32,936 KB
testcase_29 AC 101 ms
32,944 KB
testcase_30 AC 100 ms
30,924 KB
testcase_31 AC 102 ms
35,072 KB
testcase_32 AC 98 ms
32,776 KB
testcase_33 AC 98 ms
34,988 KB
権限があれば一括ダウンロードができます

ソースコード

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();
    static int[] NMi => ReadLine().Split().Select(c => int.Parse(c) - 1).ToArray();
    static int[][] NMap(int n) => Enumerable.Repeat(0, n).Select(_ => NMi).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var s = ReadLine();
        var t = ReadLine();
        var rs = s.ToList();
        rs.Reverse();
        var st = 0;
        var rst = 0;
        for (var i = 0; i < n; ++i)
        {
            if (s[i] != t[i]) ++st;
            if (rs[i] != t[i]) ++rst;
        }
        var ans = int.MaxValue;
        if (st % 2 == 0) ans = Math.Min(ans, st);
        if (rst % 2 == 1) ans = Math.Min(ans, rst);
        WriteLine(ans);
    }
}
0