QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#213187#6547. Bansheeucup-team1004#TL 1ms6100kbC++141.4kb2023-10-14 12:54:142023-10-14 12:54:15

Judging History

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

  • [2023-10-14 12:54:15]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:6100kb
  • [2023-10-14 12:54:14]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar() 
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;using LL=__uint128_t;
const int N=2e5+5,M=N*100+5,K=600+5,mod=998244353,Mod=mod-1;const db eps=1e-6;const int INF=1e9+7;mt19937 rnd(263082);
int n,m;
ll L[N],R[N];int A[N],B[N];
int CK(db mid){
	int rst=m;
	db LA=-1;
	for(int i=1;i<=n;i++){
		int x=A[i];
		if(LA>=0){
			db t=LA+max(L[i]-6,0ll)/5.25;
			if(t<=mid) {
				ll s=(mid-t)/0.89;
				if(s*24>=x) {
					LA+=(x+23)/24*0.89;
					continue;
				}
				x-=s*24;
			}
			LA=-1;
		}
		db t=max(L[i]-6,0ll)/5.25;
		ll w=(mid-t)/0.89;
		ll rt=(x-1)/w/24;
		rst-=rt;
		x-=rt*w;
		rst--;LA=(x+23)/24*0.89;
		if(rst<0) return 0;
	}
	return 1;
}
void Solve(){
	int i,j;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++) scanf("%lld%lld%d%d",&L[i],&R[i],&A[i],&B[i]),A[i]+=B[i];
	db l=max(0.0,(L[n]-6)/5.25),r=1e13,mid;
	while(l+eps<r) mid=(l+r)/2,(CK(mid)?r:l)=mid;
	printf("%.6lf\n",r);
}
int main(){
	int t=1;
	scanf("%d",&t);
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 6100kb

input:

2
2 1
1 2 1 100
100 500 736 0
3 2
0 1 12 0
1 2 6 6
2 3 3 10

output:

49.944762
1.780000

result:

ok 2 numbers

Test #2:

score: -100
Time Limit Exceeded

input:

1
1 1
999999999999 1000000000000 1000000 1000000

output:


result: