結果
問題 | No.945 YKC饅頭 |
ユーザー | hiromi_ayase |
提出日時 | 2019-12-09 02:10:52 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 3,425 bytes |
コンパイル時間 | 4,329 ms |
コンパイル使用メモリ | 86,852 KB |
実行使用メモリ | 66,940 KB |
最終ジャッジ日時 | 2023-09-01 03:34:48 |
合計ジャッジ時間 | 20,288 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 110 ms
54,632 KB |
testcase_01 | AC | 117 ms
53,272 KB |
testcase_02 | AC | 124 ms
53,652 KB |
testcase_03 | AC | 165 ms
54,596 KB |
testcase_04 | AC | 128 ms
53,652 KB |
testcase_05 | AC | 133 ms
53,648 KB |
testcase_06 | AC | 143 ms
54,764 KB |
testcase_07 | AC | 133 ms
53,640 KB |
testcase_08 | AC | 124 ms
53,660 KB |
testcase_09 | AC | 139 ms
53,632 KB |
testcase_10 | AC | 157 ms
56,784 KB |
testcase_11 | AC | 137 ms
55,040 KB |
testcase_12 | AC | 137 ms
54,720 KB |
testcase_13 | AC | 147 ms
54,776 KB |
testcase_14 | AC | 145 ms
54,852 KB |
testcase_15 | AC | 128 ms
53,728 KB |
testcase_16 | AC | 125 ms
51,456 KB |
testcase_17 | AC | 150 ms
54,948 KB |
testcase_18 | AC | 137 ms
55,008 KB |
testcase_19 | AC | 114 ms
53,364 KB |
testcase_20 | AC | 119 ms
53,340 KB |
testcase_21 | AC | 135 ms
53,436 KB |
testcase_22 | AC | 156 ms
54,944 KB |
testcase_23 | AC | 148 ms
54,940 KB |
testcase_24 | AC | 154 ms
54,876 KB |
testcase_25 | AC | 153 ms
54,568 KB |
testcase_26 | AC | 150 ms
54,876 KB |
testcase_27 | AC | 110 ms
53,264 KB |
testcase_28 | AC | 115 ms
53,868 KB |
testcase_29 | AC | 112 ms
53,252 KB |
testcase_30 | AC | 113 ms
53,368 KB |
testcase_31 | AC | 327 ms
59,312 KB |
testcase_32 | AC | 215 ms
58,516 KB |
testcase_33 | AC | 629 ms
59,784 KB |
testcase_34 | AC | 1,725 ms
64,744 KB |
testcase_35 | TLE | - |
testcase_36 | TLE | - |
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)); } }