# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
864332 |
2023-10-22T14:18:56 Z |
maks007 |
Paths (BOI18_paths) |
C++14 |
|
105 ms |
604 KB |
#include "bits/stdc++.h"
using namespace std;
#define int long long
vector <int> color;
vector <vector <int>> cntColor;
signed main () {
int n, m, k;
cin >> n >> m >> k;
color.resize(n);
cntColor.resize(n, vector <int> (k + 1, 0));
for(int i = 0; i < n; i ++) cin >> color[i];
for(int i = 0, u, v; i < m; i ++) {
cin >> u >> v;
u --, v --;
cntColor[u][color[v]] ++;
cntColor[v][color[u]] ++;
}
int ans = 0;
for(int color2 = 1; color2 <= k; color2 ++) {
for(int i = 0; i < n; i ++) {
if(color[i] == color2) {
for(int color1 = 1; color1 <= k; color1 ++) {
ans += cntColor[i][color1];
if(k == 2) continue;
for(int color3 = color1 + 1; color3 <= k; color3 ++) {
ans += 2 * (cntColor[i][color1] * cntColor[i][color3]);
}
}
}
}
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
105 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
29 ms |
476 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |