답안 #951747

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
951747 2024-03-22T12:39:02 Z mocha Paths (BOI18_paths) C++14
20 / 100
77 ms 16920 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mx = 3e5+5;

int n, m, k;
int a[mx];
long long b[6][mx];
long long ans = 0;

signed main() {
	cin.tie(0);ios::sync_with_stdio(0);

	cin >> n >> m >> k;
	for (int i=1;i<=n;i++) {
		cin >> a[i];
	}
	for (int i=1;i<=m;i++) {
		int u, v;
		cin >> u >> v;
		b[a[v]][u]++;
		b[a[u]][v]++;
	}
	for (int i=1;i<=n;i++) {
		long long tmp = 1;
		long long cnt = 0;
		for (int j=1;j<=k;j++) {
			if (a[i] == j) continue;
			tmp *= b[j][i];
			cnt += b[j][i];
		}
		if (k==1 or k==2) tmp = 0;
		ans += tmp * 2 + cnt;
	}
	cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 10584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 8540 KB Output is correct
2 Correct 28 ms 8540 KB Output is correct
3 Correct 71 ms 12380 KB Output is correct
4 Correct 39 ms 6592 KB Output is correct
5 Correct 46 ms 7760 KB Output is correct
6 Correct 55 ms 15892 KB Output is correct
7 Correct 77 ms 16920 KB Output is correct
8 Correct 68 ms 16920 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 10584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Incorrect 11 ms 12636 KB Output isn't correct
3 Halted 0 ms 0 KB -