# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
63179 |
2018-08-01T04:05:41 Z |
노영훈(#1832) |
Paths (BOI18_paths) |
C++11 |
|
589 ms |
53044 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MX=300010, inf=2e9;
int n, m, k;
vector<int> G[MX];
int C[MX];
int A[MX][5];
int B[MX][25];
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>n>>m>>k;
for(int i=1; i<=n; i++) cin>>C[i], C[i]--;
for(int i=1; i<=m; i++){
int u,v; cin>>u>>v;
G[u].push_back(v);
G[v].push_back(u);
}
for(int i=1; i<=n; i++) for(int x:G[i]) A[i][C[x]]++;
for(int i=1; i<=n; i++) A[i][C[i]]=0;
for(int i=1; i<=n; i++)
for(int x:G[i])
for(int j=0; j<k; j++) B[i][C[x]*5+j]+=A[x][j];
ll ans=0;
for(int i=1; i<=n; i++){
// 2
for(int a=0; a<k; a++) ans+=A[i][a];
// 3
for(int a=0; a<k; a++)
for(int b=a+1; b<k; b++) ans+=2LL*A[i][a]*A[i][b];
// for(int a=0; a<k; a++) for(int b=0; b<k; b++) for(int c=0; c<k; c++){
// if(a==b || b==c || c==a)
// }
}
cout<<ans<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
7416 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
133 ms |
11748 KB |
Output is correct |
2 |
Correct |
117 ms |
11748 KB |
Output is correct |
3 |
Correct |
461 ms |
52384 KB |
Output is correct |
4 |
Correct |
173 ms |
52384 KB |
Output is correct |
5 |
Correct |
213 ms |
52384 KB |
Output is correct |
6 |
Correct |
323 ms |
52384 KB |
Output is correct |
7 |
Correct |
563 ms |
52384 KB |
Output is correct |
8 |
Correct |
589 ms |
53044 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
7416 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
53044 KB |
Output is correct |
2 |
Incorrect |
35 ms |
53044 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |