# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
864334 |
2023-10-22T14:23:53 Z |
maks007 |
Paths (BOI18_paths) |
C++14 |
|
268 ms |
28368 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 ++) {
if(color1 == color2) continue;
ans += cntColor[i][color1];
if(k == 2) continue;
for(int color3 = color1 + 1; color3 <= k; color3 ++) {
if(color3 == color2) continue;
ans += 2 * (cntColor[i][color1] * cntColor[i][color3]);
}
}
}
}
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
103 ms |
604 KB |
Output is correct |
2 |
Correct |
86 ms |
2524 KB |
Output is correct |
3 |
Correct |
236 ms |
28328 KB |
Output is correct |
4 |
Correct |
128 ms |
5660 KB |
Output is correct |
5 |
Correct |
120 ms |
5508 KB |
Output is correct |
6 |
Correct |
189 ms |
20416 KB |
Output is correct |
7 |
Correct |
268 ms |
28244 KB |
Output is correct |
8 |
Correct |
234 ms |
28368 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 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 |
28 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |