当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
随机推荐
一文带你了解redux的工作流程——actionreducerstore
Cloudera Manager —— 端到端的企业数据中心管理工具
科学论文和学术论文写作
Docker安装canal、mysql进行简单测试与实现redis和mysql缓存一致性
lotus-local-net 2k v1.17.0-rc4
[Go Affair] See through Go's collections and slices at a glance
In PLC communication error or timeout or download the prompt solution of the model
Mysql环境变量的配置(详细图解)
How to correctly write the binary stream of the file returned by the server to the local file and save it as a file
VBA输出日志到工作簿demo
CoCube群机器人预览→资讯剧透←
ESP8266-Arduino编程实例-PIR(被动红外)传感器驱动
第十二章 使用中的 OpenAPI 属性
Addition logic for SAP Commerce Cloud Product Review
《MySQL高级篇》五、InnoDB数据存储结构
一、excel转pdf格式jacob.jar
2022/7/30
数据持久化技术——MP
oracle优化:instr做join条件很慢「建议收藏」
strings包详细文档+示例









