QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#307166 | #7622. Yet Another Coffee | 275307894a# | WA | 1ms | 6052kb | C++14 | 1.1kb | 2024-01-18 08:05:14 | 2024-01-18 08:05:14 |
Judging History
answer
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=5e5+5,M=N*4+5,K=(1<<25)+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(time(0));
int n,m;ll A[N];
pii B[N];
void Solve(){
int i,j;scanf("%d%d",&n,&m);
for(i=1;i<=n;i++) scanf("%lld",&A[i]);
for(i=1;i<=m;i++) scanf("%d%d",&B[i].fi,&B[i].se);
sort(B+1,B+m+1);
int R=1,Id=1;
for(i=1;i<=n;i++){
while(R<=B[i].fi) {
if(A[Id]>A[R]) Id=R;R++;
}
A[Id]-=B[i].se;
}
sort(A+1,A+n+1);
for(i=1;i<=n;i++) A[i]+=A[i-1],printf("%lld ",A[i]);printf("\n");
}
int main(){
int t=1;
scanf("%d",&t);
while(t--) Solve();
cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 6052kb
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 -3713 -3699 -3681 -3639 -3584 -3525 -3439 -3351 -3091 -2787 -2481 -2157 -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'