Submission #80795

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
807952018-10-22 11:03:44farukkastamonudaPaths (BOI18_paths)C++14
100 / 100
424 ms53192 KiB
#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];
for(int i=1; i<=n; i++) for(int a=0; a<k; a++) for(int b=0; b<k; b++)
if(a==C[i] || b==C[i]) B[i][a*5+b]=0;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...