結果
問題 | No.145 yukiover |
ユーザー | ki_ki33 |
提出日時 | 2015-02-06 00:19:30 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,408 bytes |
コンパイル時間 | 2,376 ms |
コンパイル使用メモリ | 81,204 KB |
実行使用メモリ | 43,180 KB |
最終ジャッジ日時 | 2024-06-23 09:07:05 |
合計ジャッジ時間 | 23,797 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 124 ms
41,352 KB |
testcase_01 | AC | 126 ms
41,376 KB |
testcase_02 | AC | 132 ms
41,228 KB |
testcase_03 | WA | - |
testcase_04 | AC | 113 ms
40,012 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 129 ms
41,176 KB |
testcase_09 | AC | 123 ms
41,296 KB |
testcase_10 | WA | - |
testcase_11 | AC | 194 ms
42,572 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 4,830 ms
42,344 KB |
testcase_16 | AC | 192 ms
42,868 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 276 ms
42,700 KB |
ソースコード
import java.io.BufferedInputStream; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.ConcurrentSkipListSet; public class Main { public static final int C = 1000000007; static final int CY = 1000000000; //static boolean MAP[][]; static int K; static int N; static double P; static String S; static int M; static int MAX = -1; //static int tic[][]; static int T[][]; static int Y[]; static double W[]; //static int max; static long DP[]; static int ST[][]; //static int p[]; //static ArrayList<HashSet<Integer>> al; static ConcurrentSkipListSet<Integer> TS; static ArrayList<Integer> AL; //static int a[][]; //static char[][] ch; //static ArrayList<HashMap<Long, Long>> al; //static String a[]; //static String str; public static void main(String[] args) { StringBuilder sb = new StringBuilder(); BufferedInputStream bs = new BufferedInputStream(System.in); Scanner sc = new Scanner(bs); N = sc.nextInt(); S = sc.next(); char c[] = S.toCharArray(); Arrays.sort(c); long ans = 0; LOOP:for (int i=N-1; i >= 0; i--) { if (c[i] > 'y') { ans++; }else if (c[i] == 'y'){ int indT = -1; for (int t=i-1; t >= 0; t--) { if (c[t] == 'y') { indT = t; }else if (c[t] > 'u'){ indT = t; break; }else if (c[t] == 'u') { //TODO int indV = -1; for (int v=t-1; v >= 0; v--) { if (c[v] == 'u') { indV = v; }else if (c[v] > 'k'){ indV = v; break; }else if (c[v] == 'k') { //TODO int indN = -1; for (int n=t-1; n >= 0; n--) { if (c[n] == 'u') { indN = n; }else if (c[n] > 'k'){ indN = n; break; }else if (c[n] != 0){ break; } } if (indN != -1) { c[indN] = 0; //ans++; }else { break LOOP; } }else if (c[v] != 0){ break; } } if (indV != -1) { c[indV] = 0; //ans++; }else { break LOOP; } }else if (c[t] != 0){ break ; } } if (indT != -1) { c[indT] = 0; ans++; }else { break LOOP; } }else if (c[i] != 0){ break; } } System.out.println(ans); } }