結果
問題 | No.2073 Concon Substrings (Swap Version) |
ユーザー | 👑 kakel-san |
提出日時 | 2022-09-16 23:22:31 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,684 bytes |
コンパイル時間 | 1,974 ms |
コンパイル使用メモリ | 67,888 KB |
実行使用メモリ | 25,536 KB |
最終ジャッジ日時 | 2023-08-23 16:42:48 |
合計ジャッジ時間 | 5,269 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 53 ms
20,576 KB |
testcase_01 | AC | 54 ms
22,712 KB |
testcase_02 | AC | 52 ms
22,664 KB |
testcase_03 | AC | 51 ms
20,716 KB |
testcase_04 | AC | 54 ms
20,616 KB |
testcase_05 | AC | 63 ms
22,428 KB |
testcase_06 | AC | 63 ms
22,452 KB |
testcase_07 | AC | 55 ms
20,696 KB |
testcase_08 | AC | 60 ms
19,600 KB |
testcase_09 | AC | 62 ms
23,904 KB |
testcase_10 | AC | 69 ms
22,616 KB |
testcase_11 | AC | 68 ms
22,588 KB |
testcase_12 | AC | 54 ms
20,624 KB |
testcase_13 | AC | 56 ms
22,624 KB |
testcase_14 | AC | 66 ms
22,024 KB |
testcase_15 | AC | 60 ms
20,724 KB |
testcase_16 | AC | 63 ms
20,320 KB |
testcase_17 | AC | 54 ms
20,584 KB |
testcase_18 | AC | 56 ms
20,672 KB |
testcase_19 | AC | 60 ms
22,292 KB |
testcase_20 | AC | 58 ms
23,804 KB |
testcase_21 | AC | 58 ms
21,480 KB |
testcase_22 | AC | 61 ms
22,468 KB |
testcase_23 | AC | 55 ms
22,688 KB |
testcase_24 | AC | 56 ms
22,636 KB |
testcase_25 | AC | 60 ms
23,632 KB |
testcase_26 | AC | 63 ms
22,516 KB |
testcase_27 | AC | 53 ms
18,724 KB |
testcase_28 | AC | 60 ms
21,960 KB |
testcase_29 | AC | 59 ms
20,692 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 | - |
ソースコード
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); } }