Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
34391 | daimo | 【S】T1 | C++ | 输出超限 | 0 | 551 MS | 23704 KB | 640 | 2024-11-07 18:32:43 |
#include<bits/stdc++.h> #define int long long using namespace std; int num[1000010]; int dp[1000010]; int r[1000010],cost[1000010]; int p[100010]; priority_queue<int>q; signed main(){ //freopen("poker.in","r",stdin); //freopen("poker.out","w",stdout); int n; cin>>n; for(int i=1;i<=n;i++){ char ch; cin>>ch; num[i]=ch-'0'; } for(int i=1;i<=n;i++)cin>>r[i]; for(int i=1;i<=n;i++)cin>>cost[i]; int hd=0,ed=-1,sum=0; for(int i=1;i<=n;i++){ while(!q.empty()&&-q.top()<i)q.pop(); int add=q.size(); if((num[i]+add)%2==1)sum+=cost[i],q.push(-r[i]),cout<<i<<endl; } cout<<sum<<endl; return 0; }