[Codeforces Round495B] Sonya and Exhibition
[题目链接]
https://codeforces.com/contest/1004/problem/B
[算法]
不难发现 , 最优解一定是01010101....
时间复杂度 : O(N)
[代码]
#include<bits/stdc++.h>
using namespace std; template <typename T> inline void read(T &x)
{
T f = ; x = ;
char c = getchar();
for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
for (; isdigit(c); c = getchar()) x = (x << ) + (x << ) + c - '';
x *= f;
} int main()
{ int n,m;
read(n); read(m);
for (int i = ; i <= m; i++)
{
int a,b;
read(a); read(b);
}
for (int i = ; i <= n; i++) printf("%d",(i % ) ? : );
printf("\n"); return ; }
[Codeforces Round495B] Sonya and Exhibition的更多相关文章
- B - Sonya and Exhibition CodeForces - 1004B (思维题)
B. Sonya and Exhibition time limit per test 1 second memory limit per test 256 megabytes input stand ...
- Sonya and Exhibition 1004B
B. Sonya and Exhibition time limit per test 1 second memory limit per test 256 megabytes input stand ...
- Codeforces 714C. Sonya and Queries Tire树
C. Sonya and Queries time limit per test:1 second memory limit per test: 256 megabytes input:standar ...
- Codeforces 713A. Sonya and Queries
题目链接:http://codeforces.com/problemset/problem/713/A 题意: Sonya 有一个可放置重复元素的集合 multiset, 初始状态为空, 现给予三种类 ...
- Codeforces 713C Sonya and Problem Wihtout a Legend(单调DP)
[题目链接] http://codeforces.com/problemset/problem/713/C [题目大意] 给出一个数列,请你经过调整使得其成为严格单调递增的数列,调整就是给某些位置加上 ...
- CodeForces 1151F Sonya and Informatics
题目链接:http://codeforces.com/problemset/problem/1151/F 题目大意: 给定长度为 n 的 01 序列,可以对该序列操作 k 次,每次操作可以交换序列中任 ...
- Codeforces 713C Sonya and Problem Wihtout a Legend DP
C. Sonya and Problem Wihtout a Legend time limit per test 5 seconds memory limit per test 256 megaby ...
- Codeforces C. Sonya and Problem Wihtout a Legend(DP)
Description Sonya was unable to think of a story for this problem, so here comes the formal descript ...
- Codeforces 713C Sonya and Problem Wihtout a Legend(DP)
题目链接 Sonya and Problem Wihtout a Legend 题意 给定一个长度为n的序列,你可以对每个元素进行$+1$或$-1$的操作,每次操作代价为$1$. 求把原序列变成 ...
随机推荐
- 全局唯一的支付和订单id生成算法
数据库存储的是两个Long类型的复合主键.显示到页面的是一个27位的数字单号 package com.yunyihenkey.common.idworker; /** * * @desc * @aut ...
- 【原】thinkphp修改Redis操作类,支持选择数据库功能及添加其他方法
版本3.2.2(ThinkPHP\Library\Think\Cache\Driver\Redis.class.php), 一:官方默认不支持选择数据库功能及,现就可选择数据库功能进行说明. 1 co ...
- LTTng
Waiting for dig... http://frederic-wou.net/lttng/
- 记一些关于acm的小知识(自用,粗糙,勿点呀)
#define INF 0x7ffffff,定义一个很大的数
- QT使用插件QAxWidget来展示web页面
要求:用qt版开发一个桌面程序,该程序有一个界面,用来显示一个采用silverlight开发的web页面. 分析:在qt中实现web显示,根据qt的版本和对应编译器的版本,有如下选择: (1)5.6以 ...
- 集合类(Collection和Map接口)简介
集合分为Collection和Map,详细分类如下图所示: 以下是测试验证代码: //HashSet,无序(存取不一致).去重 Set set_H = new HashSet(); set_H.add ...
- notepad++使用NppFTP连接linux,编写shell脚本无法保存上传的问题
下载安装NppFTP插件之后,重启打开notepad++连接到linux主机,之后进行编辑shell脚本,出现无法保存上传至linux主机的问题. 分析的原因:可能的原因是Windows防火墙阻止了应 ...
- Centos6文本安装教程
Centos6.4文本方式安装 虚拟机中文本安装(内存512),内存大于512默认为图形安装 1.选择安装媒体,在vbox中选skip跳过 2.选择安装语言(chinese(simplifired)简 ...
- Struts2学习笔记:DMI,多个配置文件,默认Action,后缀
动态方法调用有三种方法: 1.同一Action多次映射,每个action标签的method对应要调用的方法. 当要调用的方法多了就会增加struts.xml文件的复杂性. 2.struts.Dynam ...
- Laravel5.5 综合使用
使用 Laravel5.5 开发一个自动交割的项目,把使用到的开源扩展包及特性整理起来,以供后续使用. 一.安装IDE提示工具 Laravel IDE Helper 是一个极其好用的代码提示及补全工具 ...