結果

問題 No.945 YKC饅頭
ユーザー watarimaycry2watarimaycry2
提出日時 2021-01-03 20:07:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,304 ms / 2,000 ms
コード長 3,428 bytes
コンパイル時間 2,763 ms
コンパイル使用メモリ 83,708 KB
実行使用メモリ 98,728 KB
最終ジャッジ日時 2024-04-21 15:26:52
合計ジャッジ時間 44,795 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
40,256 KB
testcase_01 AC 105 ms
40,516 KB
testcase_02 AC 118 ms
40,344 KB
testcase_03 AC 140 ms
40,920 KB
testcase_04 AC 115 ms
40,520 KB
testcase_05 AC 123 ms
40,852 KB
testcase_06 AC 133 ms
41,256 KB
testcase_07 AC 121 ms
40,656 KB
testcase_08 AC 113 ms
40,356 KB
testcase_09 AC 116 ms
40,444 KB
testcase_10 AC 132 ms
40,876 KB
testcase_11 AC 120 ms
40,476 KB
testcase_12 AC 128 ms
40,824 KB
testcase_13 AC 144 ms
41,200 KB
testcase_14 AC 142 ms
41,080 KB
testcase_15 AC 116 ms
40,812 KB
testcase_16 AC 114 ms
40,388 KB
testcase_17 AC 136 ms
41,268 KB
testcase_18 AC 141 ms
40,896 KB
testcase_19 AC 110 ms
40,728 KB
testcase_20 AC 108 ms
40,600 KB
testcase_21 AC 107 ms
40,376 KB
testcase_22 AC 152 ms
41,140 KB
testcase_23 AC 144 ms
41,180 KB
testcase_24 AC 154 ms
41,084 KB
testcase_25 AC 148 ms
41,152 KB
testcase_26 AC 144 ms
41,212 KB
testcase_27 AC 108 ms
40,540 KB
testcase_28 AC 118 ms
40,576 KB
testcase_29 AC 104 ms
40,296 KB
testcase_30 AC 102 ms
40,252 KB
testcase_31 AC 317 ms
46,904 KB
testcase_32 AC 347 ms
53,232 KB
testcase_33 AC 604 ms
62,352 KB
testcase_34 AC 717 ms
72,324 KB
testcase_35 AC 984 ms
90,764 KB
testcase_36 AC 762 ms
85,748 KB
testcase_37 AC 720 ms
78,920 KB
testcase_38 AC 762 ms
73,700 KB
testcase_39 AC 432 ms
56,108 KB
testcase_40 AC 538 ms
58,328 KB
testcase_41 AC 380 ms
51,504 KB
testcase_42 AC 832 ms
89,924 KB
testcase_43 AC 687 ms
78,860 KB
testcase_44 AC 858 ms
82,712 KB
testcase_45 AC 931 ms
90,792 KB
testcase_46 AC 292 ms
50,456 KB
testcase_47 AC 770 ms
73,344 KB
testcase_48 AC 349 ms
50,948 KB
testcase_49 AC 580 ms
58,728 KB
testcase_50 AC 994 ms
95,648 KB
testcase_51 AC 1,156 ms
97,240 KB
testcase_52 AC 1,087 ms
98,728 KB
testcase_53 AC 1,133 ms
98,224 KB
testcase_54 AC 1,078 ms
98,496 KB
testcase_55 AC 1,155 ms
97,888 KB
testcase_56 AC 392 ms
57,484 KB
testcase_57 AC 333 ms
56,500 KB
testcase_58 AC 1,092 ms
85,724 KB
testcase_59 AC 1,165 ms
92,728 KB
testcase_60 AC 837 ms
71,696 KB
testcase_61 AC 1,116 ms
90,800 KB
testcase_62 AC 1,187 ms
88,148 KB
testcase_63 AC 390 ms
56,572 KB
testcase_64 AC 939 ms
71,912 KB
testcase_65 AC 928 ms
69,688 KB
testcase_66 AC 856 ms
69,520 KB
testcase_67 AC 1,044 ms
78,972 KB
testcase_68 AC 961 ms
71,656 KB
testcase_69 AC 568 ms
61,316 KB
testcase_70 AC 576 ms
62,632 KB
testcase_71 AC 657 ms
63,072 KB
testcase_72 AC 931 ms
75,236 KB
testcase_73 AC 1,304 ms
92,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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------------------------------------------
}
0