QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#245818#6691. Ordersyiyiyi#AC ✓1ms3696kbC++14720b2023-11-10 12:57:542023-11-10 12:57:55

Judging History

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

  • [2023-11-10 12:57:55]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3696kb
  • [2023-11-10 12:57:54]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define inf 0x3f3f3f3f
#define N 1020000
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
//const int mo=998244353;
inline int read(){
	int x=0,w=0;char ch=getchar();
	while (!isdigit(ch))w|=ch=='-',ch=getchar();
	while (isdigit(ch))x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
	return w?-x:x;
}
pii a[N];
void solve(){
	int n=read(),k=read(),fl=1,sum=0;
	for (int i=1;i<=n;++i)a[i].fi=read(),a[i].se=read();
	sort(a+1,a+1+n);
	for (int i=1;i<=n;++i){
		sum+=(a[i].fi-a[i-1].fi)*k;
		sum-=a[i].se;
		if (sum<0)fl=0;
	}
	puts(fl?"Yes":"No");
}
signed main(){
    int T=read();
    while (T--)solve();
    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 3696kb

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