Acwing第 62 场周赛【未完结】
AcWing 周赛 62
2023-09-11 14:15:52 时间
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;
}
相关文章
- Acwing第 70 场周赛【未完结】
- Acwing第 66 场周赛【完结】
- Acwing第 63 场周赛【未完结】
- Acwing第 61 场周赛【完结】
- Acwing第 52 场周赛【完结】
- Acwing第 45 场周赛【完结】
- Acwing第 37 场周赛【完结】
- Acwing第 36 场周赛【完结】
- Acwing第 33 场周赛【完结】
- Acwing第 28 场周赛【完结】
- Acwing第 27 场周赛【完结】
- Acwing第 19 场周赛【完结】
- Acwing第 18 场周赛【完结】
- Acwing第 13 场周赛【未完结】
- Acwing第 9 场周赛【未完结】
- Acwing第 5 场周赛【未完结】
- [Acwing]836. 合并集合
- 197、【动态规划】AcWing —— 901. 滑雪(C++版本)
- 167、【动态规划】AcWing ——83. 股票的最大利润 (C++版本)