QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#704844#7622. Yet Another Coffeeszy10010WA 1ms5596kbC++231.4kb2024-11-02 21:16:082024-11-02 21:16:09

Judging History

你现在查看的是最新测评结果

  • [2024-11-02 21:16:09]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5596kb
  • [2024-11-02 21:16:08]
  • 提交

answer

#include <map>
#include <set>
#include <queue>
#include <deque>
#include <cmath>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <unordered_map>
using namespace std;
#define fi first
#define se second
#define u1 (u<<1)
#define u2 (u<<1|1)
#define pb emplace_back
#define pp pop_back()
#define int long long
#define laile cout<<"laile"<<endl
#define lowbit(x) ((x)&(-x))
#define double long double
#define sf(x) scanf("%lld",&x)
#define sff(x,y) scanf("%lld %lld",&x,&y)
#define sd(x) scanf("%Lf",&x)
#define sdd(x,y) scanf("%Lf %Lf",&x,&y)
#define _for(i,n) for(int i=0;i<(n);++i)
#define _rep(i,a,b) for(int i=(a);i<=(b);++i)
#define _pre(i,a,b) for(int i=(a);i>=(b);--i)
#define all(x) (x).begin(), (x).end()
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef unsigned long long ULL;
typedef pair<int,int>PII;
typedef pair<double,double>PDD;
const int N=1e6+10,INF=4e18;
int n,m;
int cunmiidx[N];
int q[N];
void solve()
{
	int mi=INF,miidx=-1;
	cin>>n>>m;
	_rep(i,1,n)
	{
		cin>>q[i];
		if(q[i]<mi)mi=q[i],miidx=i;
		cunmiidx[i]=miidx;//前i个数的最小值下标
	}
	_rep(i,1,m)
	{
		int a,b;
		cin>>a>>b;
		q[cunmiidx[a]]-=b;
	}
	sort(q+1,q+1+n);
	int sum=0;
	_rep(i,1,n)
	{
		sum+=q[i];
		cout<<sum<<' ';
	}
	cout<<'\n';
	return ;
}
signed main()
{
	IOS;
	int T=1;
    cin>>T;
	while(T--)
		solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5596kb

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:

-2596 -2559 -2506 -2447 -2382 -2314 -2241 -2130 -1970 -1793 
-1008 -1991 -2881 -3387 -3345 -3290 -3231 -3143 -2883 -2579 -2273 -1949 
-4500 -6315 -6422 -6374 -6258 -6092 -5922 -5743 -5563 -5368 -5167 -4934 -4691 -4428 -4156 -3875 -3591 -3272 -2946 
-1792 -2804 -2572 -2140 -1707 -1238 -768 -274 243 1...

result:

wrong answer 11th numbers differ - expected: '-3505', found: '-1008'