QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#412121#6691. OrderszrzringAC ✓0ms3636kbC++201.2kb2024-05-16 08:41:212024-05-16 08:41:22

Judging History

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

  • [2024-05-16 08:41:22]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3636kb
  • [2024-05-16 08:41:21]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;

#define endl '\n'
#define PII std::pair<i64, i64>
#define NO return (void)(std::cout << "NO" << endl)
#define YES return (void)(std::cout << "YES" << endl)
#define Fast_IOS std::ios::sync_with_stdio(false), std::cin.tie(0), std::cout.tie(0)

const i64 mod = 998244353;

template <class T> void MOD(T &x) {x = (x % mod + mod) % mod;}
template <class T> T lg(T x) {return (T)log10(x);}
template <class T> T log(T x) {return (T)log2(x);}
template <class T> T abs(T x) {return x < 0 ? -x : x;}
template <class T> T mysqrt(T x) {return std::floor(sqrtl(x));}

struct WORK {
	int n, m;

	WORK() {}

	void solve() {
		int n, m;
		std::cin >> n >> m;
		std::vector<PII> a(n + 1);
		for (int i = 1; i <= n; i++) {
			int x, t;
			std::cin >> x >> t;
			a[i] = {x, t};
		}
		std::sort(a.begin(), a.end());
		i64 sum = 0;
		for (int i = 1; i <= n; i++) {
			sum += a[i].second;
			if (sum > a[i].first * m) {
				return (void)(std::cout << "No" << endl);
			}
		}
		return (void)(std::cout << "Yes" << endl);
	}
};

int main() {
	Fast_IOS;
	WORK work;
	int T = 1;
	std::cin >> T;
	while (T--) {
		work.solve();
	}
	return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3636kb

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: 0ms
memory: 3600kb

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