답안 #148499

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148499 2019-09-01T04:33:23 Z ummm(#3574, cerberus, aayush9, knandy) 함수컵 박물관 (FXCUP4_museum) C++17
27 / 100
1000 ms 2424 KB
#include "museum.h"
#include <bits/stdc++.h>

using namespace std;

long long CountSimilarPairs(vector<int> B, vector<int> T, vector<int> G) {
	int N = B.size();
	vector<vector<int> > v;
	v.push_back(B); v.push_back(T); v.push_back(G);
	long long ans = 0;
	for(int i = 0; i < 3; i++) {
		multiset<int> m;
		for(int j = 0; j < N; j++) {
			ans += m.count(v[i][j]);
			m.insert(v[i][j]);
		}
	}
	for(int i = 0; i < 3; i++) {
		multiset<pair<int,int> > m;
		for(int j = 0; j < N; j++) {
			ans -= m.count({v[(i+1)%3][j], v[(i+2)%3][j]});
			m.insert({v[(i+1)%3][j], v[(i+2)%3][j]});
		}
	}
	multiset<pair<pair<int,int>, int> > m;
	for(int i = 0; i < N; i++) {
		ans += m.count({{v[0][i], v[1][i]}, v[2][i]});
		m.insert({{v[0][i], v[1][i]}, v[2][i]});
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 6 ms 256 KB Output is correct
6 Correct 7 ms 512 KB Output is correct
7 Correct 8 ms 512 KB Output is correct
8 Correct 17 ms 512 KB Output is correct
9 Correct 11 ms 512 KB Output is correct
10 Correct 10 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 6 ms 256 KB Output is correct
6 Correct 7 ms 512 KB Output is correct
7 Correct 8 ms 512 KB Output is correct
8 Correct 17 ms 512 KB Output is correct
9 Correct 11 ms 512 KB Output is correct
10 Correct 10 ms 384 KB Output is correct
11 Correct 25 ms 896 KB Output is correct
12 Execution timed out 1100 ms 2424 KB Time limit exceeded
13 Halted 0 ms 0 KB -