Submission #149105

# Submission time Handle Problem Language Result Execution time Memory
149105 2019-09-01T05:45:01 Z Outfraware Boat People(#3577, c4big, bsyo2k, cepiloth) FunctionCup Museum (FXCUP4_museum) C++17
Compilation error
0 ms 0 KB
#include "museum.h"

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

std::map<std::string, int> m;

void score(int i, int j) {
	std::string s;
	s.append(std::to_string(i));
	s.append(std::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();

	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 'long long int CountSimilarPairs(std::vector<int>, std::vector<int>, std::vector<int>)':
museum.cpp:33:18: error: cannot convert 'std::map<std::__cxx11::basic_string<char>, int>' to 'int' for argument '1' to 'void score(int, int)'
     score(m, i, j);
                  ^
museum.cpp:38:18: error: cannot convert 'std::map<std::__cxx11::basic_string<char>, int>' to 'int' for argument '1' to 'void score(int, int)'
     score(m, i, j);
                  ^
museum.cpp:43:18: error: cannot convert 'std::map<std::__cxx11::basic_string<char>, int>' to 'int' for argument '1' to 'void score(int, int)'
     score(m, i, j);
                  ^