QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#265194#7102. Live LoveliaopengfeiWA 0ms3900kbC++14458b2023-11-25 17:11:172023-11-25 17:11:18

Judging History

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

  • [2023-11-25 17:11:18]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3900kb
  • [2023-11-25 17:11:17]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int T,n,m;
int check(int x){
	int ss=0,tot=0;
	for(int i=1;i<=n;++i) 
		if(tot<x) tot++;
		else{
			ss++;tot=0;
		} 
	if(ss>n-m) return 0;
	return 1;
}
int main(){
	scanf("%d",&T);
	while(T--){
		scanf("%d%d",&n,&m);
		printf("%d ",m);
		int l=1,r=n,ans=1;
		while(l<=r){
			int mid=(l+r)>>1;
			if(check(mid)) ans=mid,r=mid-1;
			else l=mid+1;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
5 4
100 50
252 52
3 0
10 10

output:

4 2
50 1
52 1
0 1
10 10

result:

wrong answer 4th lines differ - expected: '0 0', found: '0 1'