链接:https://codeforces.com/contest/1100/problem/B

题意:

给n,m。

给m个数,每个数代表一个等级,没给一个将其添加到题目池中,当题目池中有难度(1-n)的题目都存在时,

即可产生一次竞赛。

每给一个数,如果可以出竞赛,输出1,否则输出0。

思路:

一个变量记录有几种题目,一个数组记录每种题目有几个。

能出题时将每种题目的数量减一,减完后为0,则记录种类变量减一。

代码:

#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5+10;
int a[MAXN];
int sum = 0; int main()
{
int n,m,v;
scanf("%d%d",&n,&m);
for (int i = 0;i<m;i++)
{
scanf("%d",&v);
a[v]++;
if (a[v] == 1)
sum++;
if (sum == n)
{
printf("1");
for (int i = 1;i<=n;i++)
{
a[i]--;
if (a[i] == 0)
sum--;
}
}
else
{
printf("0");
}
}
printf("\n"); return 0;
}

  

Codeforces Round #532(Div. 2) B.Build a Contest的更多相关文章

  1. Codeforces Round #532 (Div. 2)

    Codeforces Round #532 (Div. 2) A - Roman and Browser #include<bits/stdc++.h> #include<iostr ...

  2. Codeforces Round #532 (Div. 2) 题解

    Codeforces Round #532 (Div. 2) 题目总链接:https://codeforces.com/contest/1100 A. Roman and Browser 题意: 给出 ...

  3. 水题 Codeforces Round #307 (Div. 2) A. GukiZ and Contest

    题目传送门 /* 水题:开个结构体,rk记录排名,相同的值有相同的排名 */ #include <cstdio> #include <cstring> #include < ...

  4. Codeforces Round #532 (Div. 2) Solution

    A. Roman and Browser 签到. #include <bits/stdc++.h> using namespace std; ]; int get(int b) { ]; ...

  5. Codeforces Round #532 (Div. 2) F 线性基(新坑) + 贪心 + 离线处理

    https://codeforces.com/contest/1100/problem/F 题意 一个有n个数组c[],q次询问,每次询问一个区间的子集最大异或和 题解 单问区间子集最大异或和,线性基 ...

  6. Codeforces Round #532 (Div. 2):F. Ivan and Burgers(贪心+异或基)

    F. Ivan and Burgers 题目链接:https://codeforces.com/contest/1100/problem/F 题意: 给出n个数,然后有多个询问,每次回答询问所给出的区 ...

  7. Codeforces Round #532 (Div. 2)- B(思维)

    Arkady coordinates rounds on some not really famous competitive programming platform. Each round fea ...

  8. Codeforces Round #532(Div. 2) C.NN and the Optical IIIusion

    链接:https://codeforces.com/contest/1100/problem/C 题意: 一个圆球外面由其他圆球包裹,两两相连. 给出n,r. n为外面圆球数量,r为内部圆球半径. 求 ...

  9. Codeforces Round #532(Div. 2) A.Roman and Browser

    链接:https://codeforces.com/contest/1100/problem/A 题意: 给定n,k. 给定一串由正负1组成的数. 任选b,c = b + i*k(i为任意整数).将c ...

随机推荐

  1. Python 的枚举类型

    起步 Python 中的枚举类型 Python 的原生类型中并不包含枚举类型.为了提供更好的解决方案,Python 通过 PEP 435 在 3.4 版本中添加了 enum 标准库. 枚举类型可以看作 ...

  2. HTML预览 正则替换

    1. [代码][PHP]代码  <?php    if(!defined('BASEPATH')) exit('No direct script access allowed');    /** ...

  3. mycat的事务支持情况

    中秋国庆一共12天,玩的有点嗨,完全没想工作的事情- -.回来赶紧补补.看了一下mycat关于事务的支持情况,做一下记录. 说mycat的事务支持之前,先说说XA协议,即分布式事务.指的是TM(事务管 ...

  4. Java 高阶 —— 相等性比较

    1. 包装类 所有的相同类型的包装类对象之间的值的比较,全部使用 equals 方法: 对于 Integer a = ?,在 -128 到 127 范围内的赋值,Integer 对象是在 Intege ...

  5. 将linux系统用户导入mysql表

    下面这个程序实现的一个很简单的功能,读取passwd文件,将里面的用户信息写入到mysql里面, 具体代码如下: #!/usr/bin/python import pymysql import tim ...

  6. linux学习 三 redhat

    1: 查看redhat版本号. 2:   防火墙中加入8080 查看防火墙状态,root用户登录,执行命令systemctl status firewalld 开启防火墙:systemctl star ...

  7. sql语句之查询操作

    语法顺序: select distinct 字段1,字段2,字段3 from 库.表 where 条件 group by 分组条件 having 过滤 # 执行顺序的话,到这步会返回运行select语 ...

  8. c++拷贝函数详解(转)

    一. 什么是拷贝构造函数 首先对于普通类型的对象来说,它们之间的复制是很简单的,例如 int a = 100; int b = a; 而类对象与普通对象不同,类对象内部结构一般较为复杂,存在各种成员变 ...

  9. 1-2关键字 & 2-1什么是变量

    2-1什么是变量 驼峰第一个字母首字母小写后面字母首字母大写 Pascal命名规范:

  10. springboot+mongodb报错Caused by: java.net.ConnectException: Connection refused (Connection refused)

    com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.connection.SocketStrea ...