Codeforces Round #270:C;http://codeforces.com/contest/472

题意:水题

题解:贪心即可。

 #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int N=1e5+;
int n;
char str1[N][];
char str2[N][];
int a[N];
int main(){
scanf("%d",&n);
for(int i=;i<=n;i++){
scanf("%s %s",str1[i],str2[i]);
}
for(int i=;i<=n;i++){
scanf("%d",&a[i]);
}
int temp=;
bool flag=false;
if(strcmp(str1[a[]],str2[a[]])<){
temp=;
}
else
temp=;
//printf("%d\n",temp);
for(int i=;i<=n;i++){
// printf("%d %d\n",a[i-1],temp);
if(strcmp(str1[a[i]],str2[a[i]])<){
if(temp==){
if(strcmp(str1[a[i]],str1[a[i-]])>){
temp=;
continue;
}
if(strcmp(str2[a[i]],str1[a[i-]])<){
flag=true;
break;
} }
else{
if(strcmp(str1[a[i]],str2[a[i-]])>){
temp=;
continue;
}
if(strcmp(str2[a[i]],str2[a[i-]])<){
flag=true;
break;
} }
temp=; }
else{ if(temp==){
if(strcmp(str2[a[i]],str1[a[i-]])>){
temp=;
continue;
}
if(strcmp(str1[a[i]],str1[a[i-]])<){
flag=true;
break;
} }
else{
if(strcmp(str2[a[i]],str2[a[i-]])>){
temp=;
continue;
}
if(strcmp(str1[a[i]],str2[a[i-]])<){
flag=true;
break;
} }
temp=; }
}
if(flag)puts("NO");
else
puts("YES"); }

Design Tutorial: Make It Nondeterministic的更多相关文章

  1. cf472C Design Tutorial: Make It Nondeterministic

    C. Design Tutorial: Make It Nondeterministic time limit per test 2 seconds memory limit per test 256 ...

  2. codeforces C. Design Tutorial: Make It Nondeterministic

    题意:每一个人 都有frist name 和 last name! 从每一个人的名字中任意选择 first name 或者 last name 作为这个人的编号!通过对编号的排序,得到每一个人 最终顺 ...

  3. Codeforces #270 D. Design Tutorial: Inverse the Problem

    http://codeforces.com/contest/472/problem/D D. Design Tutorial: Inverse the Problem time limit per t ...

  4. cf472D Design Tutorial: Inverse the Problem

    D. Design Tutorial: Inverse the Problem time limit per test 2 seconds memory limit per test 256 mega ...

  5. cf472B Design Tutorial: Learn from Life

    B. Design Tutorial: Learn from Life time limit per test 1 second memory limit per test 256 megabytes ...

  6. cf472A Design Tutorial: Learn from Math

    A. Design Tutorial: Learn from Math time limit per test 1 second memory limit per test 256 megabytes ...

  7. Codeforces Round #270--B. Design Tutorial: Learn from Life

    Design Tutorial: Learn from Life time limit per test 1 second memory limit per test 256 megabytes in ...

  8. Qsys 设计流程---Qsys System Design Tutorial

    Qsys 设计流程 ---Qsys System Design Tutorial 1.Avalon-MM Pipeline Bridge Avalon-MM Pipeline Bridge在slave ...

  9. D. Design Tutorial: Inverse the Problem 解析含快速解法(MST、LCA、思維)

    Codeforce 472D Design Tutorial: Inverse the Problem 解析含快速解法(MST.LCA.思維) 今天我們來看看CF472D 題目連結 題目 給你一個\( ...

随机推荐

  1. C#数据等待

    1 public bool WaitData() 2 { 3 bool states = false; 4 try 5 { 6 DateTime Get_Time = DateTime.Now; 7 ...

  2. Metadata file not found - Data.Entity.Model

    错误 3 正在编译转换: 未能找到元数据文件“F:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\..\IDE\Micr ...

  3. DOM4J方式解析XML文件

    dom4j介绍 dom4j的项目地址:http://sourceforge.net/projects/dom4j/?source=directory dom4j是一个简单的开源库,用于处理XML. X ...

  4. 第三篇、FMDB使用

    简介: FMDB是基于SQlite3的封装一个第三方的OC库,操作起来更加简单,性能比Coredata更加高. 1.创建sqlite文件 2.导入FMDB头文件 3.创建数据库表table 4.编写s ...

  5. jfinal取消默认跳转到view.jsp页面的方法

    今天为了在一个列表中添加一个删除的方法,直接在方法里面谢了一个dao.del();方法,但是调用的时候却出现404错误. 然后就写了一句下面的代码 redirect("/api/listMe ...

  6. VS2010 VS2012 如何连接Oracle 11g数据库

    oracle是开发者常用的数据库,在做.NET开发是,由于Vs自带的驱动只能连接oracle 10g及以下版本,那么如何连接oracle 11g呢? 工具/原料   事先安装VS2010或者VS201 ...

  7. FancyBox——jQuery弹出窗口插件

    最近工作项目中有用到这款插件,就查找了一下相关资料和用法,下面是一些基本的简单用法,比较容易掌握,有需要的小伙伴可以参考.:) FancyBox是一款基于jquery开发的类Lightbox插件.支持 ...

  8. [数据结构] 成都磨子桥技工学校 Challenge Series

    Challenge 0: 第一次裸写竟然WA了.... Challenge 1: 不想写了.

  9. 九度OJ 朋友圈 -- 并查集

    题目地址:http://ac.jobdu.com/problem.php?pid=1526 题目描述: 假如已知有n个人和m对好友关系(存于数字r).如果两个人是直接或间接的好友(好友的好友的好友.. ...

  10. mysql 删除日志

    mysql日志过大,想用rm 删除掉,后来想一下,是不是有别的方法,搜索一下,果然有..... mysql > PURGE MASTER LOGS BEFORE '2014-03-16 00:0 ...