#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
const int N = 300001,INF=1e12;
int n , m , k , x , vis[N];
vector<int>col[4];
vector<set<int>>edges(N);
int ans=0;
int32_t main()
{
//freopen("abc.in", "r", stdin);
cin >> n >> m >> k ;
for(int i = 1 ; i <= n ; i ++){
cin >> x;
col[x].push_back(i);
}
for(int i = 0 ; i < m ; i ++)
{
int u , v ;
cin >> u >> v;
edges[u].insert(v);
edges[v].insert(u);
}
vector<vector<int>>v;
v.push_back({1,2,3});
v.push_back({1,3,2});
v.push_back({2,1,3});
int ans=0;
for(int i = 0 ; i < v.size() ; i ++){
for(int j = 0 ; j < col[v[i][0]].size() ; j ++){
for(int p = 0 ; p < col[v[i][1]].size() ; p ++){
if(edges[col[v[i][0]][j]].count(col[v[i][1]][p])){
ans++;
for(int k = 0 ; k < col[v[i][2]].size() ; k ++){
if(edges[col[v[i][1]][p]].count(col[v[i][2]][k])){
ans+=3;
}
}
}
}
}
}
cout<<ans<<endl;
}
Compilation message
paths.cpp: In function 'int32_t main()':
paths.cpp:30:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
30 | for(int i = 0 ; i < v.size() ; i ++){
| ~~^~~~~~~~~~
paths.cpp:31:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
31 | for(int j = 0 ; j < col[v[i][0]].size() ; j ++){
| ~~^~~~~~~~~~~~~~~~~~~~~
paths.cpp:32:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
32 | for(int p = 0 ; p < col[v[i][1]].size() ; p ++){
| ~~^~~~~~~~~~~~~~~~~~~~~
paths.cpp:35:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
35 | for(int k = 0 ; k < col[v[i][2]].size() ; k ++){
| ~~^~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
14292 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3076 ms |
42636 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
14292 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
14344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |