結果
問題 | No.945 YKC饅頭 |
ユーザー | hiromi_ayase |
提出日時 | 2019-12-09 02:10:52 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 3,425 bytes |
コンパイル時間 | 3,238 ms |
コンパイル使用メモリ | 96,092 KB |
実行使用メモリ | 64,588 KB |
最終ジャッジ日時 | 2024-06-11 02:05:37 |
合計ジャッジ時間 | 16,842 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 118 ms
47,660 KB |
testcase_01 | AC | 117 ms
40,772 KB |
testcase_02 | AC | 125 ms
40,760 KB |
testcase_03 | AC | 153 ms
41,520 KB |
testcase_04 | AC | 127 ms
41,172 KB |
testcase_05 | AC | 127 ms
40,756 KB |
testcase_06 | AC | 141 ms
41,784 KB |
testcase_07 | AC | 131 ms
41,152 KB |
testcase_08 | AC | 122 ms
41,180 KB |
testcase_09 | AC | 128 ms
41,344 KB |
testcase_10 | AC | 140 ms
41,716 KB |
testcase_11 | AC | 133 ms
41,032 KB |
testcase_12 | AC | 128 ms
41,132 KB |
testcase_13 | AC | 150 ms
41,812 KB |
testcase_14 | AC | 153 ms
41,496 KB |
testcase_15 | AC | 136 ms
41,164 KB |
testcase_16 | AC | 131 ms
41,076 KB |
testcase_17 | AC | 153 ms
41,812 KB |
testcase_18 | AC | 142 ms
41,696 KB |
testcase_19 | AC | 120 ms
40,760 KB |
testcase_20 | AC | 125 ms
40,988 KB |
testcase_21 | AC | 127 ms
41,004 KB |
testcase_22 | AC | 148 ms
41,952 KB |
testcase_23 | AC | 151 ms
41,952 KB |
testcase_24 | AC | 150 ms
41,828 KB |
testcase_25 | AC | 152 ms
41,576 KB |
testcase_26 | AC | 152 ms
41,796 KB |
testcase_27 | AC | 120 ms
40,620 KB |
testcase_28 | AC | 119 ms
40,628 KB |
testcase_29 | AC | 117 ms
40,796 KB |
testcase_30 | AC | 119 ms
40,716 KB |
testcase_31 | AC | 358 ms
46,740 KB |
testcase_32 | AC | 218 ms
44,484 KB |
testcase_33 | AC | 660 ms
52,776 KB |
testcase_34 | AC | 1,764 ms
54,824 KB |
testcase_35 | TLE | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
testcase_50 | -- | - |
testcase_51 | -- | - |
testcase_52 | -- | - |
testcase_53 | -- | - |
testcase_54 | -- | - |
testcase_55 | -- | - |
testcase_56 | -- | - |
testcase_57 | -- | - |
testcase_58 | -- | - |
testcase_59 | -- | - |
testcase_60 | -- | - |
testcase_61 | -- | - |
testcase_62 | -- | - |
testcase_63 | -- | - |
testcase_64 | -- | - |
testcase_65 | -- | - |
testcase_66 | -- | - |
testcase_67 | -- | - |
testcase_68 | -- | - |
testcase_69 | -- | - |
testcase_70 | -- | - |
testcase_71 | -- | - |
testcase_72 | -- | - |
testcase_73 | -- | - |
ソースコード
import java.util.Arrays; import java.util.PriorityQueue; public class Main { private static void solve() { int n = ni(); int m = ni(); int[][] p = new int[m][4]; for (int i = 0; i < m; i++) { p[i][0] = ni() - 1; p[i][1] = ni() - 1; char t = ns()[0]; if (t == 'Y') { p[i][2] = 0; } else if (t == 'K') { p[i][2] = 1; } else { p[i][2] = 2; } p[i][3] = i; } Arrays.sort(p, (o1, o2) -> o1[0] - o2[0]); int ptr = 0; PriorityQueue<int[]> q1 = new PriorityQueue<>((o1, o2) -> o1[3] - o2[3]); PriorityQueue<int[]> q2 = new PriorityQueue<>((o1, o2) -> o1[1] - o2[1]); int[] ret = new int[3]; for (int i = 0; i < n; i++) { while (ptr < m && p[ptr][0] == i) { q1.add(p[ptr]); q2.add(p[ptr]); ptr++; } while (q2.size() > 0 && q2.peek()[1] < i) { int[] x = q2.poll(); q1.remove(x); } if (q1.size() > 0) ret[q1.peek()[2]]++; } System.out.println(ret[0] + " " + ret[1] + " " + ret[2]); } public static void main(String[] args) { new Thread(null, new Runnable() { @Override public void run() { long start = System.currentTimeMillis(); String debug = args.length > 0 ? args[0] : null; if (debug != null) { try { is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug)); } catch (Exception e) { throw new RuntimeException(e); } } reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768); solve(); out.flush(); tr((System.currentTimeMillis() - start) + "ms"); } }, "", 64000000).start(); } private static java.io.InputStream is = System.in; private static java.io.PrintWriter out = new java.io.PrintWriter(System.out); private static java.util.StringTokenizer tokenizer = null; private static java.io.BufferedReader reader; public static String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new java.util.StringTokenizer(reader.readLine()); } catch (Exception e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } private static double nd() { return Double.parseDouble(next()); } private static long nl() { return Long.parseLong(next()); } private static int[] na(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = ni(); return a; } private static char[] ns() { return next().toCharArray(); } private static long[] nal(int n) { long[] a = new long[n]; for (int i = 0; i < n; i++) a[i] = nl(); return a; } private static int[][] ntable(int n, int m) { int[][] table = new int[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { table[i][j] = ni(); } } return table; } private static int[][] nlist(int n, int m) { int[][] table = new int[m][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { table[j][i] = ni(); } } return table; } private static int ni() { return Integer.parseInt(next()); } private static void tr(Object... o) { if (is != System.in) System.out.println(java.util.Arrays.deepToString(o)); } }