結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー tentententen
提出日時 2023-01-20 11:02:14
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 2,069 bytes
コンパイル時間 2,782 ms
コンパイル使用メモリ 85,732 KB
実行使用メモリ 57,496 KB
最終ジャッジ日時 2023-09-05 05:15:45
合計ジャッジ時間 10,820 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,572 KB
testcase_01 AC 45 ms
49,392 KB
testcase_02 AC 44 ms
49,332 KB
testcase_03 AC 45 ms
49,452 KB
testcase_04 AC 46 ms
49,544 KB
testcase_05 AC 163 ms
55,016 KB
testcase_06 AC 168 ms
55,036 KB
testcase_07 AC 45 ms
49,364 KB
testcase_08 AC 137 ms
54,528 KB
testcase_09 AC 143 ms
55,092 KB
testcase_10 AC 180 ms
55,320 KB
testcase_11 AC 178 ms
55,164 KB
testcase_12 AC 45 ms
49,240 KB
testcase_13 AC 82 ms
52,028 KB
testcase_14 AC 157 ms
55,328 KB
testcase_15 AC 112 ms
52,096 KB
testcase_16 AC 162 ms
55,172 KB
testcase_17 AC 45 ms
49,380 KB
testcase_18 AC 80 ms
51,812 KB
testcase_19 AC 169 ms
55,360 KB
testcase_20 AC 151 ms
52,864 KB
testcase_21 AC 135 ms
54,764 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        char[] inputs = sc.next().toCharArray();
        int[][] counts = new int[3][3];
        char[] con = "con".toCharArray();
        for (int i = 0; i < n * 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (con[j] == inputs[i]) {
                    counts[i % 3][j]++;
                }
            }
        }
        int ans = 0;
        for (int i = 0; i < 3; i++) {
            int tmp = Integer.MAX_VALUE;
            for (int j = 0; j < 3; j++) {
                tmp = Math.min(tmp, counts[(i + j) % 3][j]);
            }
            ans += tmp;
        }
        System.out.println(ans);
    }
}

class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0