QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#214177#6547. Bansheeucup-team206#WA 0ms3916kbC++171.5kb2023-10-14 17:45:322023-10-14 17:45:32

Judging History

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

  • [2023-10-14 17:45:32]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3916kb
  • [2023-10-14 17:45:32]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,s,t) for(int i=(s),_t=(t); i<=_t; ++i)
#define DOR(i,s,t) for(int i=(s),_t=(t); i>=_t; --i)
typedef long long ll;
typedef double db;
const int N=2e5+50;
struct node {
    int l,r,h,s;
} a[N];
int b[N];
int n,m;
bool check(db mid) {
    FOR(i,1,n) b[i]=a[i].h+a[i].s;
    int p=n;
    ll cnt=0;
    while(true) {
        while(p && !b[p]) --p;
        if(!p) break;
        ll v=floor((mid-max(0,a[p].l-6)/5.25)/0.89);
        // cerr << mid << ' ' << p << ' ' << v << endl;
        if(v<=0) return 0;
        ll w=v*24;
        cnt+=b[p]/w;
        b[p]%=w;
        if(!b[p]) continue;
        ++cnt;
        v-=(b[p]+23)/24;
        b[p]=0;
        --p;
        while(p) {
            if(v*24>=b[p]) {
                v-=(b[p]+23)/24;
                --p;
            } else {
                b[p]-=v*24;
                break;
            }
        }
    }
    return cnt<=m;
}
int main () {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(9);
    // cout << 94/5.25+36*0.89 << endl;
    int T;
    cin >> T;
    while(T--) {
        cin >> n >> m;
        FOR(i,1,n) cin >> a[i].l >> a[i].r >> a[i].h >> a[i].s;
        // cerr << check(33) << endl;
        db L=0,R=1e15;
        FOR(_,1,100) {
            db mid=(L+R)/2;
            if(check(mid)) R=mid;
            else L=mid;
        }
        cout << R << '\n';
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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.944761905
1.780000000

result:

ok 2 numbers

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3860kb

input:

1
1 1
999999999999 1000000000000 1000000 1000000

output:

0.000000000

result:

wrong answer 1st numbers differ - expected: '190476264642.11713', found: '0.00000', error = '1.00000'