# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
952846 |
2024-03-25T02:49:57 Z |
koukirocks |
Paths (BOI18_paths) |
C++17 |
|
1 ms |
604 KB |
#include <bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0); cin.tie(0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
namespace{using namespace std;}
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MAX=15+10,P=1e9+7;
const ll INF=0x3f3f3f3f,oo=0x3f3f3f3f3f3f3f3f;
int n,m,k;
int clr[MAX];
vector<int> G[MAX];
int main() {
speed;
cin>>n>>m>>k;
for (int i=1;i<=n;i++) {
cin>>clr[i];
}
for (int i=0;i<m;i++) {
int a,b;
cin>>a>>b;
G[a].push_back(b);
G[b].push_back(a);
}
ll l2=0;
ll l3=0;
for (int i=1;i<=n;i++) {
ll cal[4]={0,0,0,0};
for (int u:G[i]) cal[clr[u]]++;
for (int c=1;c<=k;c++) {
if (c==clr[i]) continue;
l2+=cal[c];
for (int c2=c+1;c2<=k;c2++) {
if (c2==clr[i]) continue;
l3+=cal[c]*cal[c2];
}
}
}
cout<<l2+l3*2<<"\n";
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 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |