当前位置:网站首页>Acwing第 62 场周赛【未完结】
Acwing第 62 场周赛【未完结】
2022-07-31 11:43:00 【辉小歌】
https://www.acwing.com/activity/content/competition/problem_list/2105/
4501. 收集卡牌
#include<bits/stdc++.h>
using namespace std;
const int N=1e5*5+10;
int a[N],n;
struct node{
int x,id;};
vector<node>ve;
bool cmp(node a,node b){
return a.x<b.x;}
map<int,int>mp;
int main(void)
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
if(mp[a[i]]) continue;
mp[a[i]]++,ve.push_back({
a[i],i});
}
sort(ve.begin(),ve.end(),cmp);
if(ve.size()>=3)
cout<<ve[0].id<<" "<<ve[1].id<<" "<<ve[2].id<<endl;
else
cout<<"-1 -1 -1";
return 0;
}
4501. 收集卡牌

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int a[N],mp[N],n,m;
int main(void)
{
cin>>m>>n;
for(int i=1;i<=n;i++) cin>>a[i];
int cnt=0;
for(int i=1;i<=n;i++)
{
if(mp[a[i]]==0) cnt++,mp[a[i]]++;
else mp[a[i]]++;
if(cnt==m)
{
for(int j=1;j<=m;j++)
{
mp[j]--;
if(mp[j]==0) cnt--;
}
cout<<1;
}
else cout<<0;
}
return 0;
}
边栏推荐
- 【软件工程之美 - 专栏笔记】33 | 测试工具:为什么不应该通过QQ/微信/邮件报Bug?
- 《MySQL高级篇》五、InnoDB数据存储结构
- ApiPost 真香真强大,是时候丢掉 Postman、Swagger 了
- vb.net 画曲线
- [Go Affair] See through Go's collections and slices at a glance
- Is the working process of the belt you know the story - actionreducerstore
- Read through the interface to call the artifact RestTemplate
- 若枚举映射的值不存在,则不进行反序列化
- 基于Multisim的函数信号发生器–方波、三角波、正弦波[通俗易懂]
- 蓝牙协议栈开发板 STM32F1 跑蓝牙协议栈 –传统蓝牙搜索演示以及实现原理[通俗易懂]
猜你喜欢

Data Persistence Technology - MP

【软件工程之美 - 专栏笔记】33 | 测试工具:为什么不应该通过QQ/微信/邮件报Bug?

ESP8266-Arduino编程实例-HDC1008温度湿度传感器驱动

The most complete phpmyadmin vulnerability summary

一文吃透接口调用神器RestTemplate

生信周刊第38期

Docker installs canal and mysql for simple testing and achieves cache consistency between redis and mysql

《MySQL高级篇》五、InnoDB数据存储结构

"JUC Concurrent Programming - Advanced" 06 - Immutability of Shared Models (Design of Immutable Classes | Use of Immutable Classes | Flyweight Pattern)

准确率(Accuracy)、精度(Precision)、召回率(Recall)和 mAP 的图解
随机推荐
最新MySql安装教学,非常详细
MySQL index usage and optimization
SAP Commerce Cloud Product Review 的添加逻辑
MySQL 的几种碎片整理方案总结(解决delete大量数据后空间不释放的问题)
数据持久化技术——MP
Docker installs canal and mysql for simple testing and achieves cache consistency between redis and mysql
xmind使用指南(XMind具有下列哪些功能)
使用内存映射加快PyTorch数据集的读取
IDEA configure method annotation automatic parameters
Docker搭建Mysql主从复制
3D激光SLAM:LeGO-LOAM论文解读---点云分割部分
DCM middleware family welcomes a new member
musl Reference Manual
Distributed Transactions - Introduction to Distributed Transactions, Distributed Transaction Framework Seata (AT Mode, Tcc Mode, Tcc Vs AT), Distributed Transactions - MQ
St. Regis Takeaway Project: New dishes and dishes paged query
Mysql环境变量的配置(详细图解)
The most complete phpmyadmin vulnerability summary
准确率(Accuracy)、精度(Precision)、召回率(Recall)和 mAP 的图解
Summary of several defragmentation schemes for MySQL (to solve the problem of not releasing space after deleting a large amount of data)
Docker实践经验:Docker 上部署 mysql8 主从复制