# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
952852 |
2024-03-25T03:01:42 Z |
koukirocks |
Paths (BOI18_paths) |
C++17 |
|
159 ms |
22116 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=3e5+10+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++) cout<<cal[c]<<" ";
// cout<<"\n";
if (clr[i]==1) {
l2+=cal[2]+cal[3];
l3+=cal[2]*cal[3];
} else if (clr[i]==2) {
l2+=cal[1]+cal[3];
l3+=cal[1]*cal[3];
} else {
l2+=cal[2]+cal[1];
l3+=cal[2]*cal[1];
}
// cout<<l2<<" "<<l3<<"\n";
}
cout<<l2+2*l3<<"\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
7260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
41 ms |
13908 KB |
Output is correct |
2 |
Correct |
44 ms |
13276 KB |
Output is correct |
3 |
Correct |
132 ms |
21496 KB |
Output is correct |
4 |
Correct |
62 ms |
15184 KB |
Output is correct |
5 |
Correct |
59 ms |
15188 KB |
Output is correct |
6 |
Correct |
87 ms |
19280 KB |
Output is correct |
7 |
Correct |
159 ms |
21384 KB |
Output is correct |
8 |
Correct |
126 ms |
22116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
7260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
8 ms |
14680 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |