QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#265194 | #7102. Live Love | liaopengfei | WA | 0ms | 3900kb | C++14 | 458b | 2023-11-25 17:11:17 | 2023-11-25 17:11:18 |
Judging History
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'