QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#410564 | #6691. Orders | yi_y# | WA | 2ms | 3656kb | C++11 | 972b | 2024-05-14 09:45:35 | 2024-05-14 09:45:35 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll t , n , k , f;
struct s{
ll a;
ll b;
}ss[105];
bool cmp(s q , s w){
return q.a<w.a;
}
void solve()
{
for(int i = 0 ; i < n ; i++){
cin >> ss[i].a >> ss[i].b;
}
sort(ss,ss+n,cmp);
ll sum= ss[0].a * k - ss[0].b;
if(sum<0)
{
puts("No");return;
}
for(int i=1;i<n;i++)
{
sum += (ss[i].a - ss[i-1].a) * k - ss[i].b;
if(sum<0)
{
puts("No");return;
}
}
puts("Yes");
return;
}
int main(){
cin >> t;
cin >> n >> k;
while(t--){
solve();
// sum = ss[0].a * k;
// for(int i = 0 ; i < n ; i++){
// if(i!=0) sum+=((ss[i].a-ss[i-1].a)*k);
// if(sum >= ss[i].b){
// sum -=ss[i].b;
// }
// else if(sum < ss[i].b){
// cout << "No" << endl;
// f=1;
// break;
// }
// }
// if(f==0)cout << "Yes" << endl;
}
return 0;
}/*
2
4 5
6 12
1 3
6 15
8 1
3 100
3 200
4 300
6 100*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3648kb
input:
2 4 5 6 12 1 3 6 15 8 1 3 100 3 200 4 300 6 100
output:
Yes No
result:
ok 2 token(s): yes count is 1, no count is 1
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3656kb
input:
100 22 5902 2156 41112 4784 2494327 2156 18332 1932 561243 7775 6411977 4325 42582 3982 5455884 7775 3752795 1932 268336 2156 43482 4325 1574341 4325 407463 2156 3547 2156 120919 8417 3789084 4784 214691 1932 4577101 7775 7488110 3982 2029754 1932 5995988 3982 3291414 2156 1094658 69 8933 6042 13932...
output:
No No Yes Yes No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes Yes Yes No Yes Yes Yes No No Yes Yes No Yes Yes Yes Yes No Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes Yes No No Yes No Yes Yes Yes Yes Ye...
result:
wrong answer expected YES, found NO [2nd token]