QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#252208 | #7622. Yet Another Coffee | none# | WA | 0ms | 3408kb | C++14 | 920b | 2023-11-15 16:38:54 | 2023-11-15 16:38:55 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+6;
#define ll long long
#define il long long
void solve()
{
ll n,m;
cin>>n>>m;
ll res=0;
vector<ll>a(n+1);
for(int i=1;i<=n;i++)cin>>a[i];
set<pair<ll,int>>s;
vector<pair<int,int>>b(m+1);
vector<ll>sum(n+1);
for(int i=1;i<=m;i++){
int x,y;
cin>>x>>y;
b[i]={x,y};
sum[1]+=y;
sum[x+1]-=y;
}
sort(b.begin()+1,b.end());
for(int i=1;i<=n;i++)sum[i]+=sum[i-1];
int now=1;
for(int i=1;i<=n;i++){
s.insert({a[i],i});
while(now<=n&&b[now].first==i){
auto it=*s.begin();
s.erase(it);
it.first-=b[now].second;
s.insert(it);
now++;
}
}
for(auto it:s){
res+=it.first;
cout<<res<<" ";
}
cout<<'\n';
}
int main(){
ios::sync_with_stdio(false);
int t=1;
cin>>t;
//ll res=1;
//for(int i=1;i<=13;i++)res*=i;
//cout<<res<<'\n';
while(t--)solve();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3408kb
input:
5 10 14 17 37 59 65 53 73 68 177 160 111 10 177 5 193 2 30 3 63 2 339 3 263 5 178 2 190 9 23 10 328 10 200 9 8 3 391 6 230 12 9 152 306 86 88 324 59 18 14 42 260 304 55 3 50 2 170 1 252 7 811 1 713 7 215 10 201 4 926 8 319 19 20 182 74 180 201 326 243 195 31 170 263 284 233 48 166 272 281 179 116 31...
output:
-1868 -1831 -1778 -1719 -1654 -1586 -1513 -1402 -1242 -1065 -3505 -3491 -3473 -3431 -3376 -3317 -3231 -3143 -2883 -2579 -2273 -1949 -5974 -5943 -5895 -5821 -5705 -5539 -5369 -5190 -5010 -4815 -4614 -4381 -4138 -3875 -3603 -3322 -3038 -2719 -2393 -3219 -2987 -2572 -2140 -1707 -1238 -768 -274 243 1...
result:
wrong answer 1st numbers differ - expected: '-2596', found: '-1868'