QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#410557#6691. Ordersxuan_yWA 0ms3612kbC++14553b2024-05-14 09:25:382024-05-14 09:25:38

Judging History

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

  • [2024-05-14 09:25:38]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3612kb
  • [2024-05-14 09:25:38]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int t , n , k , f;
long long sum;
struct s{
	int a;
	int b;
}ss[105];
bool cmp(s q , s w){
	return q.a<w.a;
		
		return q.a;
}
int main(){
	cin >> t;
	cin >> n >> k;
	while(t--){
		f=0;
		for(int i = 0 ; i < n ; i++){
			cin >> ss[i].a >> ss[i].b;
		}
		sort(ss,ss+n,cmp);
		
		for(int i = 0 ; i < n ; i++){
			 sum+=((ss[i].a-ss[i-1].a)*k);
			
				sum -=ss[i].b;
			
   			 if(sum < 0){
				
				f=1;
				break;
			}
		}
		if(f==0)cout << "Yes" << endl;
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3612kb

input:

2
4 5
6 12
1 3
6 15
8 1
3 100
3 200
4 300
6 100

output:

Yes

result:

wrong answer Answer contains longer sequence [length = 2], but output contains 1 elements