WookjeBlog
    • 블로그
    • 소개
    • 태그
    • 수업/강의
    • 라이브러리
    Main
    • Share to Facebook

    map

    All Posts in map

    • [codeforces] 1070H : BerOS File Suggestion

      1070H : BerOS File Suggestion 풀이 주어지는 string의 길이가 엄청 짧다. 모든 substring을 다 잘라서 자료구조에 넣어주자. 그럼 쉽게 구현할 수 있다. 코드 #include <iostream> #include <algorithm> #include <map> #include <set> #include <string> using namespace std; int n, q; string a[10001]; map<string, pair<int, int> > m; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for (int k = 0; k < n; k++) { string str; cin >> str; a[k] = str; set<string> s; for...

      codeforces brute-force set map

      wookje.kwon's profile image

      wookje.kwon

      2018-11-14 12:59

    • [BOJ] 16165 : 걸그룹 마스터 준석이

      16165 : 걸그룹 마스터 준석이 풀이 잘 짜주면 된다. 코드 #include <iostream> #include <string> #include <map> using namespace std; int n, m, num; string grp, str; map<string, string> mp; int main() { cin.tie(0); ios_base::sync_with_stdio(0); cin >> n >> m; while (n--) { cin >> grp >> num; while (num--) { cin >> str; mp[grp] = str; mp[str] = grp; } } while (m--) { cin >> str >> num; if (!num) for (auto it :...

      boj scal-mookja naive map string

      wookje.kwon's profile image

      wookje.kwon

      2018-10-01 09:44

    • [BOJ] 7662 : 이중 우선순위 큐

      7662 : 이중 우선순위 큐 풀이 multiset을 써서 풀었는데 map으로 풀어도 될 거 같고 아무튼 그냥 짜면 된다. 코드 #include <iostream> #include <set> using namespace std; int main() { int t; cin >> t; while (t--) { int k; cin >> k; char c; int n; multiset<int> v; while (k--) { cin >> c >> n; if (c == 'I') { v.insert(n); } else if (c == 'D' && v.size() > 0) { if (n...

      boj acm-icpc map set naive

      wookje.kwon's profile image

      wookje.kwon

      2018-09-17 12:19

    • [BOJ] 10546 : 배부른 마라토너

      COCI 2014/2015 Contest #2 2번 10546 : 배부른 마라토너 10546 : UTRKA 풀이 map 써도 되고 이렇게 짜도 된다 코드 #include <cstdio> int n, i; char a[22], s[22]; int main() { scanf("%d", &n); n *= 2; for (n--; n--;) { scanf("%s", s); for (i = 0; s[i]; i++) a[i] ^= s[i]; } printf("%s", a); return 0; } 아무말 백준, 백준 온라인 저지, BOJ, Baekjoon Online Judge, C, C++, 씨, 씨쁠쁠, JAVA, algorithm, 자바, 알고리즘, 자료구조,...

      boj coci naive string map

      wookje.kwon's profile image

      wookje.kwon

      2018-04-17 09:47

    • [BOJ] 1302 : 베스트셀러

      1302 : 베스트셀러 풀이 다정했던 사람이여 나를 잊었나 벌써 나를 잊어버렸나 코드 #include <iostream> #include <string> #include <map> using namespace std; int n, rn; string s, rs; map<string, int> m; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; while (n--) cin >> s, m[s]++; for (auto it : m) if (rn < it.second) rn = it.second, rs = it.first; cout << rs; return 0; } 아무말 백준, 백준 온라인 저지, BOJ, Baekjoon Online Judge, C,...

      boj string map

      wookje.kwon's profile image

      wookje.kwon

      2018-03-27 16:51

    • [BOJ] 1159 : 농구 경기

      1159 : 농구 경기 풀이 사실 그냥 체킹 배열에 카운트 해줘도 되는데 map 안 쓴지가 오래돼서 써봤다 ㅎㅎ 코드 #include <cstdio> #include <map> using namespace std; int n; char a[155]; map<char, int> s; int main() { scanf("%d", &n); while (n--) scanf("%s", a), s[a[0]]++; for (auto it : s) if (it.second >= 5) putchar(it.first), n++; if (n == -1) printf("%s", "PREDAJA"); return 0; } 아무말 백준, 백준 온라인 저지, BOJ, Baekjoon Online Judge, C, C++, 씨,...

      boj string map

      wookje.kwon's profile image

      wookje.kwon

      2018-01-24 18:27

    • [BOJ] 4195 : 친구 네트워크

      4195 : 친구 네트워크 풀이 새로운 친구들이 추가될 때 마다 merge를 해주자! 모든 노드에 대해 해당 원소가 속한 네트워크의 크기를 미리 구해두고 merge 할 때 합쳐주자! 이 문제에서는 map을 쓰면 편하게 구현할 수 있다. unordered_map을 사용하면 map보다 빠르게 구현할 수 있다. 자세한 건 cpp 레퍼런스를 참고하자. 코드 #include <iostream> #include <unordered_map> #include <string> #include <algorithm> using namespace std; const int n_ = 1e5 + 1; int pnt[n_ * 2], cnt[n_ * 2]; int find(int u)...

      boj map union-find

      wookje.kwon's profile image

      wookje.kwon

      2017-04-17 20:11

    • github
    • facebook
    • rss

    Copyright © Wookje Kwon. All rights reserved.