結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー 👑 kakel-sankakel-san
提出日時 2022-09-16 23:22:31
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,684 bytes
コンパイル時間 2,239 ms
コンパイル使用メモリ 113,128 KB
実行使用メモリ 27,928 KB
最終ジャッジ日時 2024-06-01 14:09:03
合計ジャッジ時間 3,385 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
25,924 KB
testcase_01 AC 24 ms
25,560 KB
testcase_02 AC 24 ms
21,432 KB
testcase_03 AC 25 ms
25,940 KB
testcase_04 AC 24 ms
23,644 KB
testcase_05 AC 32 ms
25,176 KB
testcase_06 AC 32 ms
25,180 KB
testcase_07 AC 23 ms
23,740 KB
testcase_08 AC 30 ms
26,584 KB
testcase_09 AC 30 ms
22,704 KB
testcase_10 AC 37 ms
27,040 KB
testcase_11 AC 38 ms
25,388 KB
testcase_12 AC 24 ms
25,676 KB
testcase_13 AC 25 ms
21,796 KB
testcase_14 AC 34 ms
22,832 KB
testcase_15 AC 28 ms
25,764 KB
testcase_16 AC 31 ms
25,104 KB
testcase_17 AC 23 ms
21,940 KB
testcase_18 AC 24 ms
21,536 KB
testcase_19 AC 31 ms
25,444 KB
testcase_20 AC 29 ms
24,408 KB
testcase_21 AC 28 ms
26,336 KB
testcase_22 AC 32 ms
27,408 KB
testcase_23 AC 24 ms
23,984 KB
testcase_24 AC 25 ms
25,736 KB
testcase_25 AC 29 ms
24,540 KB
testcase_26 AC 31 ms
25,180 KB
testcase_27 AC 25 ms
25,668 KB
testcase_28 AC 30 ms
22,960 KB
testcase_29 AC 26 ms
23,968 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 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 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();
    static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var s = ReadLine();

        var c0 = 0;
        var c1 = 0;
        var c2 = 0;
        var o0 = 0;
        var o1 = 0;
        var o2 = 0;
        var n0 = 0;
        var n1 = 0;
        var n2 = 0;
        for (var i = 0; i < n; ++i)
        {
            if (s[i * 3] == 'c') ++c0;
            if (s[i * 3] == 'o') ++o0;
            if (s[i * 3] == 'n') ++n0;
            if (s[i * 3 + 1] == 'c') ++c1;
            if (s[i * 3 + 1] == 'o') ++o1;
            if (s[i * 3 + 1] == 'n') ++n1;
            if (s[i * 3 + 2] == 'c') ++c2;
            if (s[i * 3 + 2] == 'o') ++o2;
            if (s[i * 3 + 2] == 'n') ++n2;
        }
        var con = Math.Min(c0, Math.Min(o1, n2));
        var onc = Math.Min(o0, Math.Min(n1, c2));
        var nco = Math.Min(n0, Math.Min(c1, o2));
        var res = con;
        res = Math.Max(res, Math.Min(n - 1, onc));
        res = Math.Max(res, Math.Min(n - 1, nco));
        res = Math.Max(res, Math.Min(n - 1, con + onc));
        res = Math.Max(res, Math.Min(n - 1, con + nco));
        res = Math.Max(res, Math.Min(n - 1, onc + nco));
        res = Math.Max(res, Math.Min(n - 2, con + onc + nco));
        WriteLine(res);
    }
}
0