QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#325330#5610. It's About Timeaggrovector#WA 1ms3588kbC++142.3kb2024-02-11 08:11:312024-02-11 08:11:32

Judging History

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

  • [2024-02-11 08:11:32]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3588kb
  • [2024-02-11 08:11:31]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> p64;
typedef vector<ll> v64;
typedef vector<v64> vv64;
typedef vector<p64> vp64;

#define PI 3.141592653589793238462643383279502884L

ll r, s, h;
std::map<v64, ld> err;

ld getErr(ld rem, v64 v) {
    return abs(rem - (1.0L/v[0]) + (1.0L/v[1]/v[2]) - (1.0L/v[1]/v[2]/v[3]));
}

void rec1(ld rem, ld range, v64 v);
void rec2(ld rem, ld range, v64 v);
void rec3(ld rem, ld range, v64 v);

void rec1(ld rem, ld range, v64 v) {
    // cout << "rem1: " << rem << endl;
    for (ll i=2; i<=1000/4; i++) {
        if (range/i > rem) {
            v[0] = i;
            ld nrem = (range/i) - rem;
            ld nrange = (range/i);
            rec2(nrem, nrange, v);
        } else {
            v[0] = i;
            v[1] = 1000L / (2*v[0]);
            v[2] = 2;
            err[v] = abs(rem - (1.0L/v[0]) + (1.0L/v[1]/v[2]) - (1.0L/v[1]/v[2]/v[3]));
            return;
        }
    }
}

void rec2(ld rem, ld range, v64 v) {
    // cout << "rem2: " << rem << endl;
    for (ll i=2; i<=1000/(2*v[0]); i++) {
        if (range/i > rem) {
            v[1] = i;
            ld nrem = (range/i) - rem;
            ld nrange = (range/i);
            rec3(nrem, nrange, v);
        } else {
            v[1] = i;
            v[2] = 1000L / (v[1]);
            err[v] = abs(rem - (1.0L/v[1]/v[2]) + (1.0L/v[1]/v[2]/v[3]));
            return;
        }
    }
}

void rec3(ld rem, ld range, v64 v) {
    // cout << "rem3: " << rem << endl;
    ll maxi = 1000 / (v[0]*v[1]);
    if (range > maxi * rem) {
        v[2] = maxi;
        err[v] = abs(rem - (range / maxi));
    } else {
        v[2] = (ll)(range/rem);
        err[v] = abs(rem - (range / v[2]));
        v[2]++;
        err[v] = abs(rem - (range / v[2]));
    }
}

int main () {
    cin >> r >> s >> h;

    ld rem = 2.0L*PI*r / s / h;
    rem = rem - (ll)rem;
    if (rem > 0.5L) {
        rem = 1.0L-rem;
    }
    rec1(rem - (ll)rem, 1.0L, {0, 0, 0});

    v64 pattern = {0, 0, 0};
    ld minErr = 1.0;
    for (auto entry : err) {
        // cout << entry.second << endl;
        if (entry.second < minErr) {
            minErr = entry.second;
            pattern = entry.first;
        }
    }

    cout << pattern[0] << " " << pattern[0]*pattern[1] << " " << pattern[0]*pattern[1]*pattern[2] << endl;

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

92998938 66660 24

output:

4 100 400

result:

ok Output is valid!

Test #2:

score: 0
Accepted
time: 1ms
memory: 3564kb

input:

92998938 66660 25

output:

2 6 30

result:

ok Output is valid!

Test #3:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

1 1 1

output:

3 15 60

result:

ok Output is valid!

Test #4:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

1000000000 1000000 1000

output:

3 15 60

result:

ok Output is valid!

Test #5:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

1000000000 1 1

output:

5 45 540

result:

ok Output is valid!

Test #6:

score: -100
Wrong Answer
time: 1ms
memory: 3568kb

input:

26373099 693335 239

output:

250 500 250000

result:

wrong answer Integer parameter [name=n3] equals to 250000, violates the range [1, 1000]