QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#623929#6691. OrdersLmR308AC ✓1ms3708kbC++171023b2024-10-09 14:23:222024-10-09 14:23:25

Judging History

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

  • [2024-10-09 14:23:25]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3708kb
  • [2024-10-09 14:23:22]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define int128 __int128_t
#define int long long
#define PII pair<int, int>
#define PDD pair<double, double>
#define fi first    
#define se second
#define lowbit(x) x & -x
#define all(x) x.begin(), x.end()
#define INF 0x3f3f3f3f3f3f3f3f
#define ls(x) x << 1
#define rs(x) x << 1 | 1
#define ull unsigned long long
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());

const int N = 1e6 + 10, M = 5e6 + 10, mod = 998244353;
const double eps = 1e-8;

int t, n, m, k;	
string sr;

void solve() {
	cin >> n >> k;
	vector<PII> a(n);
	for (auto &x : a) cin >> x.fi >> x.se;
	int sum = 0;
	sort(all(a));
	for (int i = 0; i < n; i++) {
		sum += a[i].se;
		if (k * a[i].fi < sum) {
			cout << "No\n";
			return;
		}
	}	
	cout << "Yes\n";
}

signed main() {
	cin.tie(nullptr)->sync_with_stdio(false);
	//cout.setf(ios::fixed), cout.precision(8);
	t = 1;
	cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}	

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
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
No

result:

ok 2 token(s): yes count is 1, no count is 1

Test #2:

score: 0
Accepted
time: 1ms
memory: 3708kb

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