CF1100B Build a Contest
题目地址:CF1100B Build a Contest
水题,比赛时没想就敲了个 \(O(n^2)\) 的暴力上去,结果过了Pretest,然后被Hack了
两个数组:
\(c_i\) 表示 \(i\) 出现过的次数
\(a_i\) 表示 \(i\) 在 \(c\) 中出现过的次数
初始时 \(a_0=n\) ,其他全为 \(0\)
代码:
#include <bits/stdc++.h>
using namespace std;
const int N = 100006;
int n, m, k, t, c[N], a[N];
int main() {
cin >> n >> m;
a[0] = n;
for (int i = 1; i <= m; i++) {
int x;
scanf("%d", &x);
--a[c[x]];
++a[++c[x]];
while (!a[t]) ++t;
if (t > k) {
putchar('1');
++k;
} else putchar('0');
}
return 0;
}
CF1100B Build a Contest的更多相关文章
- Codeforces Round #532(Div. 2) B.Build a Contest
链接:https://codeforces.com/contest/1100/problem/B 题意: 给n,m. 给m个数,每个数代表一个等级,没给一个将其添加到题目池中,当题目池中有难度(1-n ...
- Build a Contest-创建比赛 CodeForce1100B
题目链接:Build a Contest 题目原文 Arkady coordinates rounds on some not really famous competitive programmin ...
- Codeforces 1100 - A/B/C/D/E/F - (Undone)
链接:https://codeforces.com/contest/1100 A - Roman and Browser - [暴力枚举] 题意:浏览器有 $n$ 个网页,编号 $1 \sim n$, ...
- Codeforces Round #532 (Div. 2)
Codeforces Round #532 (Div. 2) A - Roman and Browser #include<bits/stdc++.h> #include<iostr ...
- Codeforces Round #532 (Div. 2) Solution
A. Roman and Browser 签到. #include <bits/stdc++.h> using namespace std; ]; int get(int b) { ]; ...
- Codeforces Round #532 (Div. 2) 题解
Codeforces Round #532 (Div. 2) 题目总链接:https://codeforces.com/contest/1100 A. Roman and Browser 题意: 给出 ...
- 最短路+找规律 Samara University ACM ICPC 2016-2017 Quarterfinal Qualification Contest L. Right Build
题目链接:http://codeforces.com/gym/101149/problem/L 题目大意:有n个点(其实是n+1个点,因为编号是0~n),m条有向边.起点是0,到a和b两个节点,所经过 ...
- 【2017 Multi-University Training Contest - Team 7 && hdu 6121】Build a tree
[链接]点击打开链接 [题意] 询问n个点的完全k叉树,所有子树节点个数的异或总和为多少. [题解] 考虑如下的一棵k=3叉树,假设这棵树恰好有n个节点. 因为满的k叉树,第i层的节点个数为k^(i- ...
- 2016 Multi-University Training Contest 2 D. Differencia
Differencia Time Limit: 10000/10000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Tot ...
随机推荐
- 新建体(2):create or replace object创建存储包、存储过程、函数
http://heisetoufa.iteye.com/blog/366957/ 创建一个package(包) 声明: create or replace package mpay_route is ...
- java中将string类型转int类型或者将string类型转long类型方法
将字串 String 转换成整数 int 两种方法: 1).int i = Integer.parseInt("111"); 或 i = Integer.parseInt([Str ...
- 关于mac 系统如何通过终端 连接linux服务器 并传文件!
首先要打开终端 mac远程链接服务器 输入 : ssh root@xxx.xx.xxx.xx xxx.xx.xxx.xx是端口号 后面会要求你输入password 即可远程连接 mac通过终端给 ...
- 使用property为类中的数据添加行为
对于面向对象编程特别重要的是,关注行为和数据的分离. 在这之前,先来讨论一些“坏”的面向对象理论,这些都告诉我们绝不要直接访问属性(如Java): class Color: def __init__( ...
- 20165232 2017-2018-2《Java程序设计》结对编程一 第一周总结
20165232 2017-2018-2<Java程序设计>结对编程一 第一周总结 结对对象 20165219王彦博 20165232何彦达 需求分析 实现一个程序,要求: 1 支持整数运 ...
- flask 模版语言及信息传递
if语句 格式: {% if command %} {% elif %} {% else %} {% endif %} 代码示例 flask_one.py #encoding:utf-8 from f ...
- Github/github 初始化教程
注: 由于将项目迁移到gitee,克隆gitee 的时候出现了问题.不得已,重新配置 ref : https://blog.csdn.net/jingtingfengguo/article/detai ...
- 使用List和Map遇到得空指针异常
如题,经常遇到同类得问题,因为集合在使用之前必须先new一个对象. private List<Orderdatil> orderdatilList=new ArrayList<Ord ...
- HDU 1050(搬椅子 数学)
题意是在一个有 400 个房间的走廊中搬动房间里的椅子,如果两次的路线重叠,就要分两次搬动,如果不重叠,就可以一次搬动. 开始的时候直接当成求线段重叠条数的题,发现这种思路完全是错的,比如 1 - 3 ...
- wav音频文件格式解析【个人笔记】(自用)
1. WAV格式 wav是微软开发的一种音频文件格式,注意,wav文件格式是无损音频文件格式,相对于其他音频格式文件数据是没有经过压缩的,通常文件也相对比较大些.. 支持多种音频数字,取样频率和声道, ...