关押罪犯(二分答案+染色法判二分图)

#include<bits/stdc++.h>
using namespace std;
const int N=2e4+100;
const int M=2e5+100;
int h[N],v[M],ne[M],e[M],idx;
int n,m;
int color[N];
void add(int a,int b,int c){
	v[idx]=c,e[idx]=b,ne[idx]=h[a],h[a]=idx++;
}
bool dfs(int u,int col,int rr){
	color[u]=col;
	for(int i=h[u];i!=-1;i=ne[i]){
		int j=e[i];
		if(v[i]<=rr) continue;
		if(color[j]){
			if(color[j]==color[u]) return false;
		}
		else{
			if(!dfs(j,3-col,rr)) return false;
		}
	}
	return true;
}
bool check(int x){
	memset(color,0,sizeof color);
	for(int i=1;i<=n;i++){
		if(color[i]==0) 
			if(!dfs(i,1,x)) return false;
	}
	return true;
}
int main(){
	memset(h,-1,sizeof h);
	scanf("%d%d",&n,&m);
	int l=0,r=0;
	for(int i=0;i<m;i++){
		int a,b,c;scanf("%d%d%d",&a,&b,&c);
		add(a,b,c);
		add(b,a,c);
		r=max(r,c);
	}
	while(l<r){
		int mid=l+r>>1;
		if(check(mid)) r=mid;
		else l=mid+1;
	}
	printf("%d\n",r);
	return 0;
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Fixed-point HE-AAC decoder Developed by RealNetworks, 2005===============================Overview--------This module contains a high-performance HE-AAC decoder for 32-bit fixed-point processors. The following is a summary of what is and is not supported:Supported: - MPEG2, MPEG4 low complexity decoding (intensity stereo, M-S, TNS, PNS) - spectral band replication (SBR), high-quality mode - mono, stereo, and multichannel modes - ADTS, ADIF, and raw data block file formatsNot currently supported: - main or SSR profile, LTP - coupling channel elements (CCE) - 960/1920-sample frame size - low-power mode SBR - downsampled (single-rate) SBR - parametric stereoHighlights - highly optimized for ARM processors (details in docs/ subdirectory) - reference x86 implementation - C and assembly code only (C++ not required for codec library) - reentrant, statically linkable - low memory (details in docs/ subdirectory) - option to use Intel Integrated Performance Primitives (details below)Supported platforms and toolchainsThis codec should run on any 32-bit fixed-point processor which can perform a full 32x32-bit multiply (providing a 64-bit result). The following processors and toolchains are supported: - x86, Microsoft Visual C++ - x86, GNU toolchain (gcc) - ARM, ARM Developer Suite (ADS) - ARM, Microsoft Embedded Visual C++ - ARM, GNU toolchain (gcc)ARM refers to any processor supporting ARM architecture v.4 or above. Thumb is not required.Generally ADS produces the fastest code. EVC 3 does not support inline assembly code for ARM targets, so calls to MULSHIFT32 (smull on ARM) are left as function calls. This incurs a significant performance penalty. For the fastest code on targets which do not normally use ADS consider compiling with ADS, using the -S option to output assembly code, and feeding this assembly code to the assem

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值