QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#543789 | #6691. Orders | mmzskm | WA | 4ms | 4192kb | C++17 | 696b | 2024-09-01 20:17:08 | 2024-09-01 20:17:09 |
Judging History
answer
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
const int mxn = 1e6 + 5;
typedef pair<int, int> pii;
void solve()
{
int n, k;
cin >> n >> k;
vector<pii> v(n + 1);
v[0] = { 0,0 };
for (int i = 1; i <= n; i++)
{
cin >> v[i].first >> v[i].second;
}
sort(v.begin(), v.end());
int sum = 0;
for (int i = 1; i <= n; i++)
{
sum += k * (v[i].first - v[i - 1].first);
sum -= v[i].second;
if (sum < 0)
{
cout << "No\n";
return;
}
}
cout << "Yes\n";
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
scanf("%d", &T);
while (T--)
{
solve();
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 4ms
memory: 4192kb
input:
2 4 5 6 12 1 3 6 15 8 1 3 100 3 200 4 300 6 100
output:
Yes Yes
result:
wrong answer expected NO, found YES [2nd token]