acgo题库
  • 首页
  • 题库
  • 学习
  • 竞赛
  • 讨论
  • 排行
  • 团队
  • 备赛专区

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情提交记录(0)
  • 题解

    userId_undefined

    金杰錱

    8月全勤卷王倔强青铜空间掌握者时间刺客枚举·枚举小能手模拟·模拟练习生
    3阅读
    0回复
    1点赞
  • 代码

    #include<bits/stdc++.h> using namespace std; set<int> s[2]; int n; int main(){ cin>>n; for(int i=1;i<=n;i++){ int t; cin>>t; s[t].insert(i); } while(s[0].size() || s[1].size()){ if(s[0].size() && s[1].empty()){ for(auto i:s[0]){ cout<<i<<endl; } return 0; }if(s[1].size() && s[0].empty()){ for(auto i:s[1]){ cout<<i<<endl; } return 0; } int t=*s[1].begin()<*s[0].begin();int w=0; while(1){ }

    userId_undefined

    ༺ཌༀ千年ༀད༻

    倔强青铜分支·分支解题者字符串·魔法使模拟·模拟练习生
    32阅读
    0回复
    2点赞
  • 题解

    userId_undefined

    JMZ詹总

    出道萌新空间掌握者秩序白银
    9阅读
    0回复
    0点赞
  • AC代码

    #include <bits/stdc++.h> using namespace std; int n; set<int> s[2]; int main(){ cin>>n; for(int i=1;i<=n;i++){ int t; cin>>t; s[t].insert(i); } while(s[0].size()||s[1].size()){ if(s[0].size()&&s[1].empty()){ for(auto i:s[0]){ cout<<i<<endl; } return 0; } if(s[1].size()&&s[0].empty()){ for(auto i:s[1]){ cout<<i<<endl; } return 0; } int t=*s[1].begin()<*s[0].begin(); int w=0; while(1){ auto it=s[t].upper_bound(w); if(it==s[t].end()){ break; } cout<<*it<<" "; w=*it; s[t].erase(it); t=!t; } cout<<endl; } return 0; }

    userId_undefined

    老飞宇78

    时间刺客空间掌握者分治·分治练习生字符串·魔法使循环·循环打卡人倔强青铜
    24阅读
    0回复
    1点赞
暂无数据

提交答案之后,这里将显示提交结果~

首页