[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$. 求把原序列变成 ...
随机推荐
- Apache Maven 3.0.3 (yum) 安裝 (CentOS 6.4 x64)
介紹http://maven.apache.org/ Maven是一個專案的開發,管理和綜合工具. 下載http://maven.apache.org/download.cgi 參考http://ma ...
- Eclipse报错:Setting property 'source' to 'org.eclipse.jst.jee.server:xx' did not find a matching property
Shell代码 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to ' ...
- Codeforces985E. Pencils and Boxes (单调队列)
题意:n个数 把他们放进一些盒子里 每个盒子最少放k个数 且最小和最大的差不能大于d 题解:显然排个序 对于当前点 存一下前面有哪些节点可以当作结尾 那么就可以枚举这些点的下一个点作为起点能否和当前点 ...
- 【转载】Appium环境搭建(Windows版)
注:appium安装到C盘,node.js安装到C盘 一.安装node.js 1.到官网下载node.js:https://nodejs.org/en/download/ 2.获取到安装文件后,直接双 ...
- 继 S-HR之代码创建临时表并插入数据 完整功能之员工职业信息变更报表
目的示例1: 制作员工职业信息报表[S-HR系统的报表其实就是列表o.0,醉了] EcirrWithPP.js shr.defineClass("shr.custom.EcirrWithPP ...
- UVA - 12113 Overlapping Squares(dfs+回溯)
题目: 给定一个4*4的棋盘和棋盘上所呈现出来的纸张边缘,问用不超过6张2*2的纸能否摆出这样的形状. 思路: dfs纸的张数,每一张中枚举这张纸左上角这个点的位置,暴力解题就可以了. 这个题的覆盖太 ...
- [Python数据结构] 使用List实现Stack
[Python数据结构] 使用List实现Stack 1. Stack 堆栈(Stack)又称为栈或堆叠,是计算机科学中一种特殊的串列形式的抽象数据类型(ADT),其特殊之处在于只能允许在阵列的一端进 ...
- <MyBatis>入门六 动态sql
package org.maple.mapper; import org.apache.ibatis.annotations.Param; import org.maple.pojo.Employee ...
- calculate Cp history (from Fluent) using Matlab
input data : unscaled time history of moment/thrust from ANSYS fluent example of input data, "m ...
- noip模拟赛 蒜头君的坐骑
分析:标准的棋盘dp问题. 如果没有技能,那么就很好做了,相当于传纸条的做法.有了技能的限制,我们就要加上一维表示用了多少次技能,这个时候转移就要用到dfs了,而且不能用填表法,要用刷表法,从当前位置 ...