zoukankan      html  css  js  c++  java
  • bzoj2079[Poi2010]Guilds*

    bzoj2079[Poi2010]Guilds

    题意:

    给一个图染色,要求每个图必须染上某个色同时与另外一个色的点有边相连,问可否满足要求。n≤200000。

    题解:

    直接上结论:除非有点没有与别的点相连,否则肯定能满足要求。

    代码:

     1 #include <cstdio>
     2 #include <cstring>
     3 #include <algorithm>
     4 #include <queue>
     5 #define inc(i,j,k) for(int i=j;i<=k;i++)
     6 #define maxn 200010
     7 using namespace std;
     8 
     9 inline int read(){
    10     char ch=getchar(); int f=1,x=0;
    11     while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
    12     while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    13     return f*x;
    14 }
    15 bool f[maxn]; int n,m;
    16 int main(){
    17     n=read(); m=read(); inc(i,1,m){int x=read(),y=read(); f[x]=f[y]=1;}
    18     inc(i,1,n)if(!f[i]){puts("NIE"); goto end;} puts("TAK");
    19     end: return 0;
    20 }

    20161107

  • 相关阅读:
    scheduletask任务调度(2间隔时间)
    scheduletask任务调度
    初始webservice
    ssh整合
    aop
    自定义框架(MyMvc)
    数据校验
    原生态ajax
    struts2国际化
    文件下载
  • 原文地址:https://www.cnblogs.com/YuanZiming/p/6052610.html
Copyright © 2011-2022 走看看