結果
問題 | No.945 YKC饅頭 |
ユーザー | watarimaycry2 |
提出日時 | 2021-01-03 20:07:35 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 1,102 ms / 2,000 ms |
コード長 | 3,428 bytes |
コンパイル時間 | 2,863 ms |
コンパイル使用メモリ | 83,616 KB |
実行使用メモリ | 99,036 KB |
最終ジャッジ日時 | 2024-10-13 14:17:29 |
合計ジャッジ時間 | 41,864 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 96 ms
40,184 KB |
testcase_01 | AC | 96 ms
40,492 KB |
testcase_02 | AC | 106 ms
40,312 KB |
testcase_03 | AC | 132 ms
40,796 KB |
testcase_04 | AC | 101 ms
40,392 KB |
testcase_05 | AC | 114 ms
40,588 KB |
testcase_06 | AC | 140 ms
41,036 KB |
testcase_07 | AC | 122 ms
40,704 KB |
testcase_08 | AC | 102 ms
40,000 KB |
testcase_09 | AC | 114 ms
40,732 KB |
testcase_10 | AC | 122 ms
41,100 KB |
testcase_11 | AC | 109 ms
40,720 KB |
testcase_12 | AC | 119 ms
40,728 KB |
testcase_13 | AC | 132 ms
41,244 KB |
testcase_14 | AC | 126 ms
41,116 KB |
testcase_15 | AC | 106 ms
40,492 KB |
testcase_16 | AC | 108 ms
40,140 KB |
testcase_17 | AC | 122 ms
40,940 KB |
testcase_18 | AC | 132 ms
40,644 KB |
testcase_19 | AC | 108 ms
40,636 KB |
testcase_20 | AC | 98 ms
40,156 KB |
testcase_21 | AC | 102 ms
40,288 KB |
testcase_22 | AC | 137 ms
41,292 KB |
testcase_23 | AC | 137 ms
40,848 KB |
testcase_24 | AC | 138 ms
41,292 KB |
testcase_25 | AC | 137 ms
41,000 KB |
testcase_26 | AC | 142 ms
41,304 KB |
testcase_27 | AC | 106 ms
40,636 KB |
testcase_28 | AC | 110 ms
40,584 KB |
testcase_29 | AC | 91 ms
40,268 KB |
testcase_30 | AC | 92 ms
40,576 KB |
testcase_31 | AC | 302 ms
46,156 KB |
testcase_32 | AC | 303 ms
52,960 KB |
testcase_33 | AC | 585 ms
62,020 KB |
testcase_34 | AC | 695 ms
72,780 KB |
testcase_35 | AC | 920 ms
91,160 KB |
testcase_36 | AC | 675 ms
85,816 KB |
testcase_37 | AC | 675 ms
78,792 KB |
testcase_38 | AC | 698 ms
74,084 KB |
testcase_39 | AC | 438 ms
55,572 KB |
testcase_40 | AC | 530 ms
58,460 KB |
testcase_41 | AC | 393 ms
53,184 KB |
testcase_42 | AC | 789 ms
89,028 KB |
testcase_43 | AC | 651 ms
79,260 KB |
testcase_44 | AC | 856 ms
81,864 KB |
testcase_45 | AC | 844 ms
90,660 KB |
testcase_46 | AC | 265 ms
50,432 KB |
testcase_47 | AC | 640 ms
72,932 KB |
testcase_48 | AC | 341 ms
49,764 KB |
testcase_49 | AC | 528 ms
58,968 KB |
testcase_50 | AC | 941 ms
96,352 KB |
testcase_51 | AC | 1,099 ms
99,036 KB |
testcase_52 | AC | 1,024 ms
97,984 KB |
testcase_53 | AC | 1,074 ms
96,932 KB |
testcase_54 | AC | 991 ms
95,196 KB |
testcase_55 | AC | 1,102 ms
98,056 KB |
testcase_56 | AC | 327 ms
57,880 KB |
testcase_57 | AC | 299 ms
56,532 KB |
testcase_58 | AC | 988 ms
85,260 KB |
testcase_59 | AC | 1,056 ms
94,392 KB |
testcase_60 | AC | 748 ms
73,484 KB |
testcase_61 | AC | 1,065 ms
90,556 KB |
testcase_62 | AC | 1,003 ms
87,112 KB |
testcase_63 | AC | 328 ms
57,032 KB |
testcase_64 | AC | 780 ms
71,828 KB |
testcase_65 | AC | 749 ms
68,684 KB |
testcase_66 | AC | 726 ms
69,916 KB |
testcase_67 | AC | 954 ms
79,140 KB |
testcase_68 | AC | 765 ms
71,564 KB |
testcase_69 | AC | 517 ms
61,152 KB |
testcase_70 | AC | 538 ms
62,648 KB |
testcase_71 | AC | 543 ms
62,980 KB |
testcase_72 | AC | 807 ms
75,836 KB |
testcase_73 | AC | 1,081 ms
91,332 KB |
ソースコード
import java.util.*; import java.io.*; import java.math.*; public class Main{ static void solve(){//Here is the main function int N = nextInt(); TreeSet<Integer> set = new TreeSet<>(); for(int i = 1; i <= N; i++){ set.add(i); } int y = 0; int k = 0; int c = 0; int M = nextInt(); for(int i = 0; i < M; i++){ int L = nextInt(); int R = nextInt(); String s = next(); while(true){ Object l = set.ceiling(L); if(l != null && (int)l <= R){ int check = (int)l; set.remove(check); if(s.equals("Y")){ y++; }else if(s.equals("C")){ c++; }else{ k++; } }else{ break; } } } myout(y + " " + k + " " + c); } //Method addition frame start //Method addition frame end //Don't have to see. start------------------------------------------ static class InputIterator{ ArrayList<String> inputLine = new ArrayList<>(1024); int index = 0; int max; String read; InputIterator(){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try{ while((read = br.readLine()) != null){ inputLine.addAll(Arrays.asList(read.split(" "))); } }catch(IOException e){} max = inputLine.size(); } boolean hasNext(){return (index < max);} String next(){ if(hasNext()){ return inputLine.get(index++); }else{ throw new IndexOutOfBoundsException("There is no more input"); } } } static HashMap<Integer, String> CONVSTR = new HashMap<>(); static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem. static PrintWriter out = new PrintWriter(System.out); static void flush(){out.flush();} static void myout(Object t){out.println(t);} static void myerr(Object t){System.err.print("debug:");System.err.println(t);} static String next(){return ii.next();} static boolean hasNext(){return ii.hasNext();} static int nextInt(){return Integer.parseInt(next());} static long nextLong(){return Long.parseLong(next());} static double nextDouble(){return Double.parseDouble(next());} static ArrayList<String> nextCharArray(){return myconv(next(), 0);} static ArrayList<String> nextStrArray(int size){ ArrayList<String> ret = new ArrayList<>(size); for(int i = 0; i < size; i++){ ret.add(next()); } return ret; } static ArrayList<Integer> nextIntArray(int size){ ArrayList<Integer> ret = new ArrayList<>(size); for(int i = 0; i < size; i++){ ret.add(Integer.parseInt(next())); } return ret; } static ArrayList<Long> nextLongArray(int size){ ArrayList<Long> ret = new ArrayList<>(size); for(int i = 0; i < size; i++){ ret.add(Long.parseLong(next())); } return ret; } @SuppressWarnings("unchecked") static String myconv(Object list, int no){//only join String joinString = CONVSTR.get(no); if(list instanceof String[]){ return String.join(joinString, (String[])list); }else if(list instanceof ArrayList){ return String.join(joinString, (ArrayList)list); }else{ throw new ClassCastException("Don't join"); } } static ArrayList<String> myconv(String str, int no){//only split String splitString = CONVSTR.get(no); return new ArrayList<String>(Arrays.asList(str.split(splitString))); } public static void main(String[] args){ CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, ""); solve();flush(); } //Don't have to see. end------------------------------------------ }