QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#213195 | #6547. Banshee | ucup-team1004# | WA | 320ms | 8704kb | C++14 | 1.4kb | 2023-10-14 12:58:36 | 2023-10-14 12:58:37 |
Judging History
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(lb mid){
ll rst=m;
lb LA=-1;
for(int i=1;i<=n;i++){
int x=A[i];
if(LA>=0){
lb 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;
}
lb t=max(L[i]-6,0ll)/5.25;
ll w=(mid-t)/0.89;
ll rt=(x-1)/(w+1e-9)/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];
lb 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';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 6076kb
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: 0
Accepted
time: 1ms
memory: 8104kb
input:
1 1 1 999999999999 1000000000000 1000000 1000000
output:
190476264642.117147
result:
ok found '190476264642.11716', expected '190476264642.11713', error '0.00000'
Test #3:
score: 0
Accepted
time: 108ms
memory: 8632kb
input:
1 200000 1 0 1 969249 972086 1 2 984744 984320 2 3 92755 47817 3 4 949336 988466 4 5 900430 587028 5 6 971159 502802 6 7 41633 978208 7 8 461354 662596 8 9 363071 263510 9 10 38887 360926 10 11 332384 508699 11 12 106353 110896 12 13 164201 615535 13 14 934900 317571 14 15 566503 490603 15 16 84381 ...
output:
7435986579.124762
result:
ok found '7435986579.12476', expected '7435986579.12476', error '0.00000'
Test #4:
score: 0
Accepted
time: 213ms
memory: 8704kb
input:
1 200000 333978112 0 1 992356 930126 1 2 176090 530440 2 3 737831 296956 3 4 506537 237481 4 5 707964 79385 5 6 924758 542461 6 7 105732 39650 7 8 873923 3276 8 9 32864 264522 9 10 395587 86623 10 11 350514 927988 11 12 525625 954467 12 13 244408 909598 13 14 560147 647280 14 15 242630 237857 15 16 ...
output:
38094.794762
result:
ok found '38094.79476', expected '38094.79476', error '0.00000'
Test #5:
score: 0
Accepted
time: 206ms
memory: 8624kb
input:
1 200000 1000000000 0 1 945997 933305 1 2 5390 151804 2 3 128320 798645 3 4 701383 107391 4 5 937129 989695 5 6 200579 678099 6 7 26621 111037 7 8 787156 534916 8 9 690049 664552 9 10 986545 948890 10 11 282743 37920 11 12 92545 205330 12 13 746804 959767 13 14 390635 119950 14 15 553450 693187 15 1...
output:
38094.794762
result:
ok found '38094.79476', expected '38094.79476', error '0.00000'
Test #6:
score: 0
Accepted
time: 320ms
memory: 8092kb
input:
100000 2 4 28797259691 276830799765 72278 33755 754885936393 923475252381 706795 936638 2 3 59508928733 771976493961 16966 42499 806442361566 991034882904 129056 718490 2 2 172750253246 241424267848 229419 649440 245407392377 589992423297 875885 889270 2 2 206097530212 864358471341 25515 147383 9818...
output:
143787813626.407608 153608080080.791411 46744314239.173804 187014532666.069049 88639503158.756181 133221473842.127608 111401799635.896181 98383664158.487132 159317167805.923804 80919772532.893328 153439584652.558099 147072054798.245706 107607022639.528083 53907914210.912377 146186515580.569509 77110...
result:
ok 100000 numbers
Test #7:
score: -100
Wrong Answer
time: 224ms
memory: 6068kb
input:
100000 2 4 26 41 4 12 49 93 67 31 2 2 16 30 5 6 91 100 15 54 2 2 6 33 36 29 42 81 51 40 2 2 0 10 43 41 12 27 1 1 2 4 43 53 9 4 85 90 30 7 2 4 34 49 4 18 61 80 6 45 2 2 43 69 3 20 79 96 35 6 2 3 8 10 27 3 42 77 54 16 2 4 8 9 13 8 37 62 41 11 2 4 23 27 37 22 38 50 45 2 2 4 27 46 20 6 53 58 27 48 2 3 1...
output:
9.970476 17.970476 10.417143 3.560000 15.937619 11.366191 15.684762 8.637143 6.794762 6.985239 10.732381 5.651905 5.842381 3.747143 16.065715 6.223334 8.761905 7.875238 12.509048 3.812857 10.604286 5.080477 4.637143 6.922857 8.193810 11.050953 8.827619 15.560000 12.065715 11.747143 16.890000 18.5419...
result:
wrong answer 4th numbers differ - expected: '2.92286', found: '3.56000', error = '0.21799'