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

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

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

    #include<bits/stdc++.h> #include<vector> #include<string> #include<queue> using namespace std; typedef long long ll; const ll N=1e8+5; ll n,m; int a[100005]; int q[100005]; int main(){ cin>>n; int ans=0; int r=0; int l=0; for(int i=0;i<n;i++){ int b,c,d; cin>>b>>c>>d; if(b==0){ a[r]=c; q[r]=d; r++; ans+=c; }else{ while(l<r&&d-q[l]>45){ l++; } int flag=1; for(int i=l;i<r;i++){ if(a[i]&&a[i]>=c){ flag=0; a[i]=0; break; } } if(flag) ans+=c; } } cout<<ans<<endl; return 0; }

    userId_undefined

    编程之神

    7月全勤卷王出道萌新时间刺客空间掌握者时空双修者秩序白银
    1阅读
    0回复
    0点赞
  • dian ge zan

    #include<bits/stdc++.h> #include<queue> using namespace std; int n,ans=0; struct node{ int p,y; }; queue<node>s; int main() { cin>>n; for(int i=0;i<n;i++) { int t,p,y; cin>>t>>p>>y; if(t==0) { ans+=p; s.push({p,y}); } else { bool kk=false; queue<node>a; while(!s.empty()) { node t=s.front(); s.pop(); if(y-t.y>45) { continue; } if(t.p>=p&&!kk) { kk=1; } else { a.push(t); } } s=a; if(!kk)ans+=p; } }

    userId_undefined

    151****6679

    0阅读
    0回复
    0点赞

共22条

  • 1
  • 2
20条/页
跳至页
暂无数据

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

首页