题目链接:http://codeforces.com/contest/781/problem/B


去tmd 2-SAT

直接贪心就可以过去了,优先选择第二种情况。

然而....可以被叉掉(数据水了)

ABC DDD
ABD DOG

 #include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<map>
using namespace std;
#define maxn 1001000
#define llg long long
#define yyj(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout);
llg n,m;
string a,s1,s2,la,b;
string ans[maxn];
map<string,bool>ma,mma; int main()
{
yyj("D");
cin>>n;
for (llg k=;k<=n;k++)
{
s1.clear(),s2.clear();
cin>>s1>>s2;
a.clear();
a=s1.substr(,);
b=s1.substr(,)+s2[];
if (!ma[b])
{
ma[b]=;
ans[k]=b;
mma[a]=;
}
else
{
if (ma[a] || mma[a]){cout<<"NO"; return ;}
ans[k]=a;
ma[a]=;
} }
cout<<"YES"<<endl;
for (llg i=;i<=n;i++)
{
cout<<ans[i]<<endl;
}
return ;
}

Codeforces 781B. Innokenty and a Football League的更多相关文章

  1. Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) D. Innokenty and a Football League

    地址:http://codeforces.com/contest/782/problem/D 题目: D. Innokenty and a Football League time limit per ...

  2. Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals )D. Innokenty and a Football League(2-sat)

    D. Innokenty and a Football League time limit per test 2 seconds memory limit per test 256 megabytes ...

  3. 【codeforces 782D】 Innokenty and a Football League

    [题目链接]:http://codeforces.com/contest/782 [题意] 每个队名有两种选择, 然后第一个选择队名相同的那些队只能选第二种; 让你安排队名 [题解] 首先全都选成第一 ...

  4. 【2-SAT】Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) D. Innokenty and a Football League

    先反复地扫(不超过n次),把所有可以确定唯一取法的给确定下来. 然后对于剩下的不能确定的,跑2-SAT.输出可行解时,对于a和¬a,如果a所在的强连通分量序号在¬a之前,则取a,否则不取a.如果a和¬ ...

  5. Codeforces Round #601 (Div. 2) C League of Leesins

    把每一次输入的一组数字存下来,然后把每个数字出现的组数存下来 然后找只出现过一次的数字a,那么这个数字a不是开头就是结尾,默认为开头(是哪个都无所谓),然后去找和它出现在同一组的两个数字b和c,而b和 ...

  6. Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals)

    Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) 说一点东西: 昨天晚上$9:05$开始太不好了,我在学校学校$9:40$放 ...

  7. Codeforces Round #403 (Div. 1, based on Technocup 2017 Finals)

    Div1单场我从来就没上过分,这场又剧毒,半天才打出B,C挂了好几次最后还FST了,回紫了. AC:AB Rank:340 Rating:2204-71->2133 Div2.B.The Mee ...

  8. Codeforces Round#403 (Div. 1)

    唉,昨天晚上迷迷糊糊地去打cf,结果fst两题,掉回蓝了... A.Andryusha and Colored Balloons 题意:给定一棵树,任意两个距离小等于二的点不能染相同的颜色,求最小颜色 ...

  9. Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals)A模拟 B三分 C dfs D map

    A. Andryusha and Socks time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

随机推荐

  1. Zabbix客户端(被监控端)安装配置

    1) 创建用户 groupadd zabbix useradd -g zabbix zabbix 2)zabbix软件包下载,安装 zabbix-2.2.6 http://jaist.dl.sourc ...

  2. error C2504: “XXXXXXX”: 未定义基类

    今天犯到了一个低级错误,记下来加深印象. 造成这一现象主要的原因是头文件相互包含,文件构成一个环形结构,从而编译时循环包含出错 如: AA.h中包含BB.h BB.h中包含CC.h CC.h中包含AA ...

  3. 关于springMVC 传递 对象参数的问题

    1.前端请求必须是 post 2.前端数据data必须做 json字符串处理  JSON.stringify(data) 3. contentType: 'application/json', 4.@ ...

  4. Qt 文本文件的打开、新建、保存以及另存为

    我们平时在使用windows的notepad以及其他各种软件过程中,都会有保存文件和另存为两种功能,这两者不能混为一谈. 一.保存时有两种情况,一种是对于新创建的文件,一种是对于已有的文件,前者需要打 ...

  5. oracle之存储过程和存储函数的使用和区别

    #存储过程:封装在服务器上一段sql片段,已经编译好了的代码. 1.客户端调存储过程,执行效率就会非常高效. 语法: create [or replace] procedure 存储过程名称 (参数名 ...

  6. php 数字变汉字

    //数字变汉字 function getTheWord($num) { $arr_n = array('零', '一', '二', '三', '四', '五', '六', '七', '八', '九', ...

  7. django ORM常用查询条件

    假设有一个模型 class Article(models.Model): title=models.CharField(max_length=50) content=models.TextField( ...

  8. android studio下载地址

    AndroidStudio3.0 下载地址——高速下载 https://www.androiddevtools.cn/   2017年08月20日 22:41:09 qq风轻云淡 阅读数:5559   ...

  9. oracle exadata一体机虚拟机

    14年参加partner培训的时候,拿了份oracle exadata一体机虚拟机,有兴趣的可以试试,不过比较大,压缩后10GB,解压后50GB,启动后直接可用,2RAC节点+1存储节点,环境最好内存 ...

  10. 20145308 《网络对抗》 注入shellcode+Return-to-libc攻击 学习总结

    20145308 <网络对抗> 逆向及BOF进阶实践 注入shellcode+Return-to-libc攻击 学习总结 实践目的 注入shellcode 实现Return-to-libc ...