File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
백준/Silver/7785. 회사에 있는 사람 Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 44
55### 성능 요약
66
7- 메모리: 56872 KB, 시간: 716 ms
7+ 메모리: 53440 KB, 시간: 556 ms
88
99### 분류
1010
1111자료 구조, 집합과 맵, 해시를 사용한 집합과 맵
1212
1313### 제출 일자
1414
15- 2025년 11월 1일 16:48:19
15+ 2025년 11월 1일 16:52:08
1616
1717### 문제 설명
1818
Original file line number Diff line number Diff line change @@ -8,18 +8,21 @@ public static void main(String[] args) throws IOException{
88
99 int n = Integer .parseInt (br .readLine ());
1010
11- Set <String > set = new HashSet <>();
11+ Set <String > set = new TreeSet <>(Collections . reverseOrder () );
1212
1313 while (n -- > 0 ){
1414 String [] s = br .readLine ().split (" " );
1515 if (s [1 ].equals ("enter" )) set .add (s [0 ]);
1616 else set .remove (s [0 ]);
1717 }
1818
19- List <String > al = new ArrayList <>(set );
20- Collections .sort (al , Collections .reverseOrder ());
21-
22- for (String s : al ){
19+ // List<String> al = new ArrayList<>(set);
20+ // Collections.sort(al, Collections.reverseOrder());
21+ //
22+ // for(String s : al){
23+ // sb.append(s).append("\n");
24+ // }
25+ for (String s : set ){
2326 sb .append (s ).append ("\n " );
2427 }
2528
You can’t perform that action at this time.
0 commit comments