Submission #148421

# Submission time Handle Problem Language Result Execution time Memory
148421 2019-09-01T04:21:11 Z 모현보유국(#3693, jhnah917, stonejjun03, ahgus89) FunctionCup Museum (FXCUP4_museum) C++17
Compilation error
0 ms 0 KB
#include "museum.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> p;
typedef pair<p, ll> pp;

map<ll, ll> aa;
map<p, ll> bb;
map<pp, ll> cc;

long long CountSimilarPairs(std::vector<int> a, std::vector<int> b, std::vector<int> c) {
	int n = B.size();
	
	ll ans = 0;
	
	//A
	for(int i=0; i<n; i++){
		aa[a[i]]++;
	}
	for(auto i : aa){
		ans += i.second * (i.second - 1) / 2;
	}
	aa.clear();
	
	//B
	for(int i=0; i<n; i++){
		aa[b[i]]++;
	}
	for(auto i : aa){
		ans += i.second * (i.second - 1) / 2;
	}
	aa.clear();
	
	//C
	for(int i=0; i<n; i++){
		aa[c[i]]++;
	}
	for(auto i : aa){
		ans += i.second * (i.second - 1) / 2;
	}
	aa.clear();
	
	//AB
	for(int i=0; i<n; i++){
		p now = make_pair(a[i], b[i]);
		bb[now]++;
	}
	for(auto i : bb){
		ans -= i.second * (i.second - 1) / 2;
	}
	bb.clear();
	
	//BC
	for(int i=0; i<n; i++){
		p now = make_pair(b[i], c[i]);
		bb[now]++;
	}
	for(auto i : bb){
		ans -= i.second * (i.second - 1) / 2;
	}
	bb.clear();
	
	//CA
	for(int i=0; i<n; i++){
		p now = make_pair(c[i], a[i]);
		bb[now]++;
	}
	for(auto i : bb){
		ans -= i.second * (i.second - 1) / 2;
	}
	bb.clear();
	
	//ABC
	for(int i=0; i<n; i++){
		p tmp = make_pair(a[i], b[i]);
		pp now = make_pair(tmp, c[i]);
		cc[now]++;
	}
	for(auto i : cc){
		ans += i.second * (i.second - 1) / 2;
	}
	cc.clear();
	
	return ans;
}

Compilation message

museum.cpp: In function 'long long int CountSimilarPairs(std::vector<int>, std::vector<int>, std::vector<int>)':
museum.cpp:14:10: error: 'B' was not declared in this scope
  int n = B.size();
          ^