Submission #952850

# Submission time Handle Problem Language Result Execution time Memory
952850 2024-03-25T02:58:22 Z koukirocks Paths (BOI18_paths) C++17
0 / 100
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++) 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 1 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 1 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 -