File tree Expand file tree Collapse file tree 1 file changed +41
-4
lines changed Expand file tree Collapse file tree 1 file changed +41
-4
lines changed Original file line number Diff line number Diff line change 1
- // Authored by : BaaaaaaaaaaarkingDog
1
+ // Authored by : heheHwang
2
2
// Co-authored by : -
3
- // http://boj.kr/****************
3
+ // http://boj.kr/b08e041f30cd4b509604d115173e4fd9
4
4
#include < bits/stdc++.h>
5
5
using namespace std ;
6
6
7
- int main (void ){
7
+ string op;
8
+ int N, L, P, x;
9
+ int probLevel[100'002 ]; // 이 문제가 어느 난이도였는지 저장
10
+ set<int > probByLevel[102 ]; // 난이도별로 문제 저장
11
+ int main (void ) {
8
12
ios::sync_with_stdio (0 );
9
13
cin.tie (0 );
10
-
14
+
15
+ cin >> N;
16
+ while (N--) {
17
+ cin >> P >> L;
18
+ probLevel[P] = L;
19
+ probByLevel[L].insert (P);
20
+ }
21
+ cin >> N;
22
+ while (N--) {
23
+ cin >> op;
24
+ if (op == " recommend" ) {
25
+ cin >> x;
26
+ if (x == 1 ) {
27
+ for (int i = 100 ; 0 <= i; i--) {
28
+ if (probByLevel[i].empty ()) continue ;
29
+ cout << *(prev (probByLevel[i].end ())) << ' \n ' ;
30
+ break ;
31
+ }
32
+ } else {
33
+ for (int i = 0 ; i < 101 ; i++) {
34
+ if (probByLevel[i].empty ()) continue ;
35
+ cout << *probByLevel[i].begin () << ' \n ' ;
36
+ break ;
37
+ }
38
+ }
39
+ } else if (op == " add" ) {
40
+ cin >> P >> L;
41
+ probLevel[P] = L;
42
+ probByLevel[L].insert (P);
43
+ } else if (op == " solved" ) {
44
+ cin >> P;
45
+ probByLevel[probLevel[P]].erase (P);
46
+ }
47
+ }
11
48
}
You can’t perform that action at this time.
0 commit comments