QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#577739 | #6691. Orders | shiqiaqiaya# | AC ✓ | 1ms | 3904kb | C++17 | 1.2kb | 2024-09-20 14:27:41 | 2024-09-20 14:27:42 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define int long long
mt19937_64 rd(time(0));
template <class key, class val = null_type, class cmp = less<>>
using rb_tree = tree<key, val, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template <class T, class ... A>
void debug(const T & t, const A & ... a) { cerr << "[" << t, ((cerr << ", " << a), ...), cerr << "]\n"; }
void QAQ() {
int n, k;
cin >> n >> k;
vector<array<int, 2>> a(n);
for (auto & [x, y] : a) {
cin >> x >> y;
}
sort(a.begin(), a.end());
int now = a[0][0] * k;
if (now < a[0][1]) {
cout << "NO\n";
return;
}
now -= a[0][1];
for (int i = 1; i < n; i++) {
now += (a[i][0] - a[i - 1][0]) * k;
if (now < a[i][1]) {
cout << "NO\n";
return;
}
now -= a[i][1];
}
cout << "YES\n";
}
signed main() {
int t = 1;
cin >> t;
for (cin.tie(0) -> sync_with_stdio(0), cout << fixed << setprecision(12); t--; QAQ());
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3668kb
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: 0
Accepted
time: 1ms
memory: 3904kb
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 YES YES YES YES YES YES YES NO NO YES NO YES YES YES YES YES NO YES YES YES YES YES YES YES NO NO NO YES YES NO NO YES NO NO YES NO YES YES YES YES YES NO YES YES YES YES YES NO YES YES NO YES YES NO NO NO NO NO NO YES YES YES YES YES YES YES YES YES NO YES NO YES NO NO YES NO YES YES YES NO YES ...
result:
ok 100 token(s): yes count is 62, no count is 38