답안 #149071

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
149071 2019-09-01T05:41:00 Z Outfraware Boat People(#3577, c4big, bsyo2k, cepiloth) 함수컵 박물관 (FXCUP4_museum) C++17
컴파일 오류
0 ms 0 KB
#include "museum.h"

#include <string>
#include <algorithm>
#include <map>

void score(std::map<std::string, int>& m, int i, int j) {
	std::string s;
	s.append(to_string(i));
	s.append(to_string(j));
	sort(s.begin(), s.end());
	m[s]++;
}

long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
	int N = B.size();

	std::map<std::string, int> m;
	for (int i = 0; i < N; i++) {
		int candB = B[i];
		int candT = T[i];
		int candG = G[i];
		
		for (int j = 0; j < N; j++) {
			// 같으면 continue
			if (i == j) {
				continue;
			}

			if (candB == B[j]) {
				score(m, i, j);
				continue;
			}

			if (candT == T[j]) {
				score(m, i, j);

				continue;
			}

			if (candG == G[j]) {
				score(m, i, j);
				continue;
			}

		}
	}
	return m.size();
}

Compilation message

museum.cpp: In function 'void score(std::map<std::__cxx11::basic_string<char>, int>&, int, int)':
museum.cpp:9:11: error: 'to_string' was not declared in this scope
  s.append(to_string(i));
           ^~~~~~~~~
museum.cpp:9:11: note: suggested alternatives:
In file included from /usr/include/c++/7/string:52:0,
                 from museum.cpp:3:
/usr/include/c++/7/bits/basic_string.h:6454:3: note:   'std::__cxx11::to_string'
   to_string(long double __val)
   ^~~~~~~~~
/usr/include/c++/7/bits/basic_string.h:6454:3: note:   'std::__cxx11::to_string'