Oleg and Little Ponies
Oleg and Little Ponies
Memory limit: 64 MB
Input
Output
Sample
| input | output |
|---|---|
6 4 |
111100 |
Notes
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <bitset>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
#define pii pair<int,int>
#define Lson L, mid, ls[rt]
#define Rson mid+1, R, rs[rt]
#define sys system("pause")
const int maxn=1e3+;
using namespace std;
ll gcd(ll p,ll q){return q==?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=;while(q){if(q&)f=f*p%mod;p=p*p%mod;q>>=;}return f;}
inline void umax(int &p,int q){if(p<q)p=q;}
inline void umin(int &p,int q){if(p>q)p=q;}
inline ll read()
{
ll x=;int f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
int n,m,k,t;
bool flag;
set<int>ok;
vi tmp;
char b[maxn];
bitset<maxn>a[maxn<<],c[maxn<<],ans;
inline void gao(int p)
{
if((ans&a[p])!=a[p])return;
ans|=c[p];
tmp.pb(p);
flag=true;
}
int main()
{
int i,j;
scanf("%d%d",&n,&m);
rep(i,,m)
{
scanf("%s",b);
ok.insert(i);
for(j=;b[j];j++)if(b[j]=='')a[i].set(j);
scanf("%s",b);
for(j=;b[j];j++)if(b[j]=='')c[i].set(j);
}
scanf("%s",b);
for(j=;b[j];j++)if(b[j]=='')ans.set(j);
rep(i,,m)gao(i);
for(int x:tmp)ok.erase(x);
while()
{
flag=false;
for(int x:ok)
{
gao(x);
}
if(!flag)break;
for(int x:tmp)ok.erase(x);
tmp.clear();
}
for(i=;i<n;i++)cout<<ans[i];
printf("\n");
return ;
}
Oleg and Little Ponies的更多相关文章
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- Oleg Sych - » Pros and Cons of T4 in Visual Studio 2008
Oleg Sych - » Pros and Cons of T4 in Visual Studio 2008 Pros and Cons of T4 in Visual Studio 2008 Po ...
- Interview with Oleg
Interview with Oleg time limit per test 1 second memory limit per test 256 megabytes input standard ...
- C - Oleg and shares
Problem description Oleg the bank client checks share prices every day. There are n share prices he ...
- 【57.97%】【codeforces Round #380A】Interview with Oleg
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- [CF738A]Interview with Oleg(模拟)
题目链接:http://codeforces.com/contest/738/problem/A 题意:把ogo..ogo替换成***. 写的有点飘,还怕FST.不过还好 #include <b ...
- 【Codeforces】【网络流】【线段树】【扫描线】Oleg and chess (CodeForces - 793G)
题意: 给定一个n*n的矩阵,一个格子上可以放一个车.其中有q个子矩阵,且q个子矩阵互不相交或者是重叠(但边界可以衔接).这q个子矩阵所覆盖的地方都是不能够放车的.车可以越过子矩阵覆盖的地方进行攻击( ...
- CodeForces 738A Interview with Oleg
模拟. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #includ ...
- 【codeforces 793A】Oleg and shares
[题目链接]:http://codeforces.com/contest/793/problem/A [题意] 每次你可以对1..n中的任意一个数字进行减少k操作; 问你最后可不可能所有的数字都变成一 ...
随机推荐
- How to build CppCMS 1.x.x
How to build CppCMS 1.x.x Requirements Mandatory Requirements Recommended Dependencies Suggested Dep ...
- 第14课 SourceTree程序操作介绍
http://www.atlassian.com/software/sourcetree/overview https://www.microsoft.com/net/framework/versio ...
- C++ 对象的赋值和复制 基本的
对象的赋值 如果对一个类定义了两个或多个对象,则这些对象之间是可以进行赋值,或者说,一个对象的值可以赋值给另一个同类的对象.这里所指的值是指对象中所有数 据的成员的值.对象之间进行赋值是“ ...
- springboot+webmagic实现java爬虫jdbc及mysql
前段时间需要爬取网页上的信息,自己对于爬虫没有任何了解,就了解了一下webmagic,写了个简单的爬虫. 一.首先介绍一下webmagic: webmagic采用完全模块化的设计,功能覆盖整个爬虫的生 ...
- A - Design Tutorial: Learn from Math(哥德巴赫猜想)
Problem description One way to create a task is to learn from math. You can generate some random mat ...
- Google的网站性能优化最佳实践
网站性能最佳实践 当描述一个web页面的页面速度,评价的一致性遵循许多不同的规则.这些规则是任何阶段的web开发可以应用的前端最佳实践.这个文档的每个规则都陈述于此,无论你是否运行页面测速工具-- ...
- Javascrpt核心概念(2)--操作符
学习操作符这个章节最好回忆一下C里的惯例,因为ECMAScript的标准很多继承自C的语法 一元操作符 只能操作一个值得操作符 递增和递减操作符 var age = 29; ++age; //30 v ...
- android黑科技系列——分析某直播App的协议加密原理以及调用加密方法进行协议参数构造
一.前言 随着直播技术火爆之后,各家都出了直播app,早期直播app的各种请求协议的参数信息都没有做任何加密措施,但是慢慢的有人开始利用这个后门开始弄刷粉关注工具,可以让一个新生的小花旦分分钟变成网红 ...
- 获取XML里指定的节点内容信息
HttpContent bw = new StringContent(StrXml, Encoding.UTF8, "application/Xml"); var Msg = aw ...
- MxNet : use the MxNet windows versioin
The MxNet needs the following thirdparties: 1. lapack complie lapack-3.6.1: download the lapack-3.6 ...