Codeforces 781B. Innokenty and a Football League
题目链接: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的更多相关文章
- 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 ...
- 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 ...
- 【codeforces 782D】 Innokenty and a Football League
[题目链接]:http://codeforces.com/contest/782 [题意] 每个队名有两种选择, 然后第一个选择队名相同的那些队只能选第二种; 让你安排队名 [题解] 首先全都选成第一 ...
- 【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和¬ ...
- Codeforces Round #601 (Div. 2) C League of Leesins
把每一次输入的一组数字存下来,然后把每个数字出现的组数存下来 然后找只出现过一次的数字a,那么这个数字a不是开头就是结尾,默认为开头(是哪个都无所谓),然后去找和它出现在同一组的两个数字b和c,而b和 ...
- Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals)
Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) 说一点东西: 昨天晚上$9:05$开始太不好了,我在学校学校$9:40$放 ...
- 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 ...
- Codeforces Round#403 (Div. 1)
唉,昨天晚上迷迷糊糊地去打cf,结果fst两题,掉回蓝了... A.Andryusha and Colored Balloons 题意:给定一棵树,任意两个距离小等于二的点不能染相同的颜色,求最小颜色 ...
- 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 ...
随机推荐
- Django 创建项目流程
django 项目创建流程 1 创建项目 cmd django-admin startproject 项目名称 pycharm file -- new project -- Django -- 项目名 ...
- 教你如何修改CentOS系统上的时间
直接看命令:
- How to use CAR FANS C800 Diagnostic Scan Tool to do diagnosis operation
How to use Heavy Duty Diagnostic CAR FANS C800 Diagnostic Scan Tool to do diagnosis operation Here i ...
- 单例设计模式 --c#
单例设计模式:在单例设计模式中我们要保持对象始终是唯一的 参考代码: class SingleObject { private SingleObject() { } private static Si ...
- Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFa ...
- 给PXC集群加密
MySQL的复制时明文的,不管是集群的复制还是IST/SST,直接通过抓包就可以抓取数据. 生成证书 直接使用 mysql_ssl_rsa_setup mysql_ssl_rsa_setup --da ...
- 使用UI管理docker
比较全面的对比 wangzi19870227 比较推荐的有两种(http://dockone.io/article/225): Shipyard 和 dockerui https://docs.doc ...
- ldap集成grafana
grafana版本: 5.0.3 grafana通过k8s方式安装,所以需将配置文件挂载过去. cat grafana-configmap.yaml apiVersion: v1 kind: Conf ...
- 【VNC】修改VNC分辨率大小
[VNC]修改VNC分辨率大小 VNC的分辨率过小有可能导致图形化界面操作过程中遇到"确认键或取消键"无法点击,分辨率过高又可能导致低分辨率客户端显示器无法显示.本文给出两种调整V ...
- 神经网络优化算法如何选择Adam,SGD
之前在tensorflow上和caffe上都折腾过CNN用来做视频处理,在学习tensorflow例子的时候代码里面给的优化方案默认很多情况下都是直接用的AdamOptimizer优化算法,如下: o ...