QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#543769#6691. OrdersmmzskmWA 0ms3796kbC++20860b2024-09-01 19:52:182024-09-01 19:52:19

Judging History

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

  • [2024-09-01 19:52:19]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3796kb
  • [2024-09-01 19:52:18]
  • 提交

answer

#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;

#define int long long

const int mxn = 1e6 + 5;

typedef pair<int, int> pii;

void solve()
{
    int n, k;
    scanf("%lld%lld", &n, &k);
    vector<pii> v(n);
    v.push_back({ 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)
        {
            printf("No\n");
            return;
        }
    }
    printf("Yes\n");
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int T = 1;
    scanf("%lld", &T);
    while (T--)
    {
        solve();
    }

    return 0;
}

详细

Test #1:

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

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]