QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#528715#9162. COVID testsmakrav#36.85 332ms4056kbC++205.2kb2024-08-23 20:15:492024-08-23 20:15:49

Judging History

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

  • [2024-08-23 20:15:49]
  • 评测
  • 测评结果:36.85
  • 用时:332ms
  • 内存:4056kb
  • [2024-08-23 20:15:49]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

mt19937 rnd(time(NULL));

double rand_d() {
    return (double)(rnd() % RAND_MAX) / RAND_MAX;
}

void rsh(vector<int> &x) {
    for (int i = 1; i < x.size(); i++) {
        swap(x[i], x[rnd() % (i + 1)]);
    }
}   

vector<int> fs = {4530, 15330, 28470, 57450, 73890, 109860, 147090, 191730, 219420};

void solve(int tc) {
    int n, t; 
    double p; cin >> n >> p >> t;

    for (int _ = 0; _ < t; _++) {
        vector<int> res(n);
        for (int i = 0; i < n; i++) {
            res[i] = rand_d() <= p;
        }
        auto ask = [&](string s) -> bool {
            #ifdef LOCAL 
                int ans = 0;
                for (int i = 0; i < n; i++) {
                    if (s[i] == '1') ans |= res[i];
                }
                return ans;
            #else
                cout << "Q " << s << endl;
                char c; cin >> c;
                return (c == 'P');
            #endif
        };
        auto check = [&](string ans) {
            #ifdef LOCAL 
                for (int i = 0; i < n; i++) {
                    if (ans[i] - '0' != res[i]) return false;
                }
                return true;
            #else
                cout << "A " << ans << endl;
                char c; cin >> c;
                return (c == 'C');
            #endif
        };
        if (p == 0.2) {
            string ans, req;
            for (int i = 0; i < n; i++) {
                ans += '0';
                req += '0';
            }
            int K = 2;
            for (int i = 0; i < n; i+=K) {
                for (int j = i; j < min(n, i + K); j++) req[j] = '1';
                bool answ = ask(req);
                for (int j = i; j < min(n, i + K); j++) req[j] = '0';
                if (answ) {
                    for (int j = i; j < min(n,i+K); j++) {
                        req[j] = '1';
                        if (ask(req)) {
                            ans[j] = '1'; 
                            req[j] = '0'; 
                            continue;
                        }
                        else {
                            if (j < min(n, i + K) - 1) {
                                ans[j + 1] = '1'; 
                                req[j] = '0';
                            }
                            break;
                        }
                    }
                }
            }
            assert(check(ans));
        }
        else if (p >= 0.1) {
            string ans, req;
            for (int i = 0; i < n; i++) {
                ans += '0';
                req += '0';
            }
            int K = 4;
            auto solve = [&](int l, int r, auto&&solve) -> void {
                for (int i = l; i < r; i++) req[i] = '1';
                bool rs = ask(req);
                for (int i = l; i < r; i++) req[i] = '0';
                if (!rs) return;
                if (l + 1 == r) {
                    ans[l] = '1';
                    return;
                }
                if (l + 2 == r) {
                    req[l] = '1';
                    bool rs = ask(req);
                    if (!rs) {
                        ans[l + 1] = '1';
                        req[l] = '0';
                        return;
                    }
                    ans[l] = '1';
                    req[l] = '0';
                    req[l + 1] = '1';
                    if (ask(req)) ans[l + 1] = '1';
                    req[l + 1] = '0';
                    return;
                }   
                int m = (l + r) / 2;
                solve(l, m, solve);
                solve(m, r, solve);
            };
            for (int i = 0; i < n; i+=K) {
                for (int j = i; j < min(n, i + K); j++) req[j] = '1';
                bool answ = ask(req);
                for (int j = i; j < min(n, i + K); j++) req[j] = '0';
                if (answ) {
                    int m = (i + min(n, i + K)) / 2;
                    solve(i, m, solve);
                    solve(m, min(n, i + K), solve);
                }
            }
            assert(check(ans));
        } else {
            string ans, req;
            for (int i = 0; i < n; i++) {
                ans += '0';
                req += '0';
            }
            auto solve = [&](int l, int r, auto&&solve) -> void {
                for (int i = l; i < r; i++) req[i] = '1';
                bool rs = ask(req);
                for (int i = l; i < r; i++) req[i] = '0';
                if (!rs) return;
                if (l + 1 == r) {
                    ans[l] = '1';
                    return;
                }
                int m = (l + r) / 2;
                solve(l, m, solve);
                solve(m, r, solve);
            };
            solve(0, n, solve);
            assert(check(ans));
        }
    } 
}

signed main() {
    int tt = 1;
    #ifdef LOCAL 
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        cin >> tt;
    #endif

    for (int i = 0; i < tt; i++) {
        solve(i);
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 5ms
memory: 3824kb

input:

1000 0.789673 1
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
N
P
P
P
N
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
N
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
N
P
N
P
P
P
P
P
N
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
N
P
N
P
P
N
P
P
P
P
P
P
P
P
N
P
P
P
P
P
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #2:

score: 10
Accepted
time: 11ms
memory: 3896kb

input:

1000 0.686378 1
P
P
N
N
P
P
N
N
P
P
P
N
P
P
P
P
N
P
P
P
P
P
P
P
P
N
P
P
P
P
P
N
P
P
P
P
N
P
P
P
N
P
P
P
P
P
P
N
N
P
P
P
N
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
N
P
N
P
P
P
N
P
P
N
P
P
P
P
P
P
P
P
P
P
N
P
P
N
P
P
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #3:

score: 10
Accepted
time: 0ms
memory: 3884kb

input:

1000 0.873862 1
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
N
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #4:

score: 10
Accepted
time: 5ms
memory: 3888kb

input:

1000 0.669578 1
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
N
P
N
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
N
P
P
N
P
N
P
P
N
P
P
N
P
P
P
P
P
N
P
P
P
N
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
N
P
P
P
N
P
P
P
P
N
P
P
P
P
N
P
P
N
P
P
P
N
P
P
N
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #5:

score: 10
Accepted
time: 6ms
memory: 3860kb

input:

1000 0.907052 1
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #6:

score: 10
Accepted
time: 5ms
memory: 3840kb

input:

1000 0.844418 1
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
N
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
N
P
P
N
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #7:

score: 10
Accepted
time: 3ms
memory: 3988kb

input:

1000 0.533576 1
P
P
P
P
P
P
N
P
N
P
N
P
P
P
N
P
N
P
P
N
P
N
P
P
P
N
P
P
N
P
P
N
P
N
P
P
N
P
P
N
P
P
P
N
P
P
N
P
P
P
P
P
P
P
P
N
P
N
P
P
P
P
P
P
P
P
N
P
P
P
P
P
N
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
N
N
P
P
P
N
P
P
P
P
P
P
N
P
P
N
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
N
P
N
P
P
P
N
P
N
P
N
P
P
N
P
P
P
P
N
P
P
P
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #8:

score: 10
Accepted
time: 7ms
memory: 3844kb

input:

1000 0.415944 1
N
P
N
P
N
P
N
P
P
N
P
P
N
P
N
P
N
P
N
N
N
P
P
N
N
P
N
P
P
P
P
P
P
P
P
N
P
N
P
P
N
P
P
N
N
P
P
P
P
P
N
P
P
P
P
N
P
P
P
N
P
P
N
N
P
P
P
N
P
P
N
P
P
P
N
P
P
N
P
N
P
P
N
P
N
P
N
P
N
P
P
P
P
P
P
P
P
P
N
P
N
P
P
P
P
N
P
N
P
N
P
P
N
P
P
P
P
P
P
N
P
P
P
P
P
N
P
P
P
P
P
N
P
P
N
P
P
P
P
P
P
P
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #9:

score: 10
Accepted
time: 9ms
memory: 3832kb

input:

1000 0.596017 1
P
P
P
N
P
P
P
P
N
P
P
N
P
P
N
P
P
P
P
P
N
N
P
P
P
P
P
P
N
P
P
P
N
P
P
N
P
N
P
P
N
P
P
N
N
P
P
P
N
P
P
P
P
P
P
N
P
P
P
P
P
N
P
P
P
P
P
N
P
N
P
P
P
P
P
N
P
N
P
P
P
P
P
P
N
P
P
N
P
N
P
P
N
P
N
P
P
P
P
P
P
N
P
P
P
P
P
P
N
P
N
P
N
P
P
P
P
N
P
P
N
P
P
P
N
P
N
P
N
P
P
N
P
P
P
P
N
P
P
P
P
P
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #10:

score: 10
Accepted
time: 0ms
memory: 3884kb

input:

1000 0.157686 1
N
N
N
P
P
N
N
P
P
N
P
P
N
P
P
N
N
P
N
P
P
N
N
N
P
N
P
P
N
P
N
P
P
P
P
N
P
P
N
P
P
P
N
N
P
N
P
P
N
N
N
N
N
P
P
N
N
N
N
N
P
P
N
P
P
N
N
P
N
P
P
P
N
N
P
P
N
P
P
P
P
P
P
N
N
N
N
N
P
N
P
N
P
N
P
P
N
N
P
P
P
N
N
P
N
P
P
N
N
P
N
P
P
N
N
N
P
N
P
N
N
P
P
N
P
N
N
P
N
P
P
N
P
P
N
N
N
N
N
P
P
P
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #11:

score: 10
Accepted
time: 8ms
memory: 3892kb

input:

1000 0.380215 1
P
N
P
N
P
N
P
N
P
N
P
P
N
P
N
P
P
P
P
P
N
N
P
P
N
P
P
P
P
P
N
P
P
N
P
N
P
P
N
P
N
P
P
N
P
N
P
P
P
P
P
P
P
N
P
N
P
N
P
P
P
N
N
N
N
P
N
P
N
P
P
P
N
N
P
P
N
P
P
N
P
N
P
P
N
N
P
P
P
N
P
P
N
P
P
N
N
P
N
P
P
N
P
N
P
N
P
P
P
P
P
P
P
P
P
P
P
N
N
N
P
P
P
N
P
N
P
N
P
N
N
N
P
P
N
P
N
P
P
N
N
P
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #12:

score: 10
Accepted
time: 0ms
memory: 3832kb

input:

1000 0.432565 1
P
P
P
N
P
P
N
P
P
N
N
P
P
N
P
P
P
P
P
N
P
P
N
N
N
P
P
P
P
P
P
N
P
P
P
P
N
P
P
P
P
P
P
P
P
P
N
P
P
N
P
N
P
N
P
P
P
P
P
P
N
P
P
P
N
P
N
P
P
P
P
N
P
N
P
P
N
P
P
P
N
P
P
N
P
P
P
N
P
P
P
P
N
P
P
N
P
P
N
N
P
P
N
P
N
P
N
P
N
P
N
P
P
N
P
P
P
N
N
P
P
P
N
P
N
P
P
P
P
P
P
P
P
P
P
N
P
P
N
N
P
N
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #13:

score: 10
Accepted
time: 7ms
memory: 3816kb

input:

1000 0.509199 1
P
P
P
P
P
N
P
N
P
N
P
P
P
N
N
P
N
P
P
N
P
P
N
P
P
N
P
P
P
P
P
N
P
P
P
P
P
P
P
P
N
P
P
N
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
N
P
N
P
P
N
P
P
N
P
P
P
N
P
P
N
P
P
N
P
N
P
P
N
N
P
N
P
N
P
P
P
N
N
P
P
P
P
P
P
N
P
P
N
P
P
P
P
P
P
N
N
P
P
N
P
P
N
P
P
P
N
N
P
P
P
P
P
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #14:

score: 10
Accepted
time: 0ms
memory: 3820kb

input:

1000 0.381646 1
P
N
P
N
N
P
P
P
P
P
P
N
N
P
P
P
N
N
P
P
P
N
P
P
N
P
P
P
N
P
P
N
N
P
N
P
P
P
N
P
P
P
P
N
P
N
P
N
N
P
P
P
N
P
P
N
P
N
P
N
P
P
P
P
P
N
P
P
P
N
P
P
P
P
P
P
N
P
P
N
P
P
P
P
P
P
N
N
P
P
P
N
P
N
P
P
P
N
P
P
P
P
P
N
P
P
N
P
N
P
N
P
P
P
N
P
N
N
P
P
N
N
P
P
P
P
N
P
N
P
N
P
P
P
N
P
P
N
P
P
N
N
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #15:

score: 10
Accepted
time: 0ms
memory: 3788kb

input:

1000 0.42815 1
P
P
N
P
P
N
P
P
P
N
P
P
P
P
P
P
N
P
N
P
N
P
P
N
P
P
N
P
P
P
N
P
P
P
P
P
P
N
P
N
P
P
P
P
P
N
N
P
P
P
N
N
P
P
P
P
N
P
N
P
P
N
P
P
N
P
P
N
P
P
P
N
N
P
P
N
N
P
N
P
N
P
P
N
P
P
N
P
P
P
P
P
P
P
P
N
P
N
P
P
P
P
P
N
P
P
P
P
P
N
P
P
P
N
P
P
N
P
N
P
P
N
P
P
N
N
P
P
P
P
P
N
P
P
P
N
P
N
P
N
P
P
P...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #16:

score: 10
Accepted
time: 6ms
memory: 3756kb

input:

1000 1 1
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #17:

score: 10
Accepted
time: 1ms
memory: 4056kb

input:

1000 0 1
N
C

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 1.0 1.0 translate:success

Subtask #2:

score: 26.85
Acceptable Answer

Test #18:

score: 52.47
Acceptable Answer
time: 0ms
memory: 3888kb

input:

1000 0.001 300
N
C
P
N
P
P
N
P
N
P
P
P
P
N
P
N
P
P
N
N
N
N
N
C
P
N
P
N
P
P
N
P
P
N
P
P
N
P
P
N
P
N
N
P
N
P
N
P
P
N
P
N
P
N
P
P
P
N
P
N
P
P
N
P
P
N
N
N
N
C
N
C
N
C
P
P
N
P
P
N
P
P
N
P
N
P
N
P
P
P
N
N
N
N
N
C
P
N
P
N
P
P
P
P
N
P
N
P
N
P
N
P
N
P
N
N
N
C
N
C
N
C
P
P
N
P
P
P
P
P
N
P
P
N
P
N
P
N
N
N
N
N
N...

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 0.5830 0.583 Output is correct (P=0.001, F=15.1, Q=17.8) -> 52.47 points

Test #19:

score: 28.98
Acceptable Answer
time: 17ms
memory: 3884kb

input:

1000 0.005256 300
P
P
P
P
N
P
N
P
P
P
P
P
P
N
N
N
P
P
N
P
P
N
N
N
N
P
N
P
N
P
P
P
P
N
P
N
P
N
P
N
N
N
P
N
P
P
P
N
P
P
P
P
P
N
N
N
N
N
P
N
P
P
N
P
P
N
P
P
P
N
N
N
N
C
P
N
P
P
P
N
P
N
P
P
N
P
N
P
P
P
N
N
N
N
P
P
N
P
N
P
P
N
P
P
N
P
N
P
N
N
P
P
N
P
P
P
P
N
P
N
P
N
N
N
N
C
P
N
P
N
P
N
P
P
N
P
P
N
P
N
P
...

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 0.3220 0.322 Output is correct (P=0.005256, F=51.1, Q=78.0) -> 28.98 points

Test #20:

score: 27.05
Acceptable Answer
time: 49ms
memory: 3892kb

input:

1000 0.011546 300
P
P
P
P
P
P
N
P
P
P
P
N
P
N
N
P
P
N
P
P
N
N
N
N
P
N
P
N
P
N
P
P
N
P
P
N
P
N
N
P
P
P
N
P
N
P
P
N
P
N
P
N
P
P
P
P
N
P
P
N
P
N
P
P
N
P
N
P
P
P
P
N
N
N
P
P
P
P
P
P
N
N
N
N
N
N
P
N
P
P
P
N
P
N
P
N
P
N
P
P
N
P
N
P
N
P
P
N
P
P
N
P
P
N
N
N
P
N
P
P
P
P
P
P
N
N
N
N
P
P
P
P
P
P
N
N
N
N
N
C
P
...

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 0.30055555560 0.3005555556 Output is correct (P=0.011546, F=94.9, Q=150.1) -> 27.05 points

Test #21:

score: 26.85
Acceptable Answer
time: 160ms
memory: 3816kb

input:

1000 0.028545 300
P
P
P
P
P
P
P
P
P
P
N
N
N
N
N
P
P
N
P
P
P
N
P
P
N
N
N
N
P
P
P
P
N
P
P
N
P
N
P
P
N
P
N
P
N
N
P
P
N
P
N
P
P
P
P
N
N
P
P
P
N
N
P
N
P
P
N
P
N
P
P
N
N
P
P
N
P
P
N
P
N
P
P
P
N
P
N
N
P
P
N
P
N
P
N
P
P
N
P
N
P
N
P
P
N
P
N
P
P
P
P
N
P
P
N
P
N
P
N
N
P
P
P
P
N
P
P
P
N
P
P
N
P
P
N
P
N
P
N
P
N
...

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 0.29833333330 0.2983333333 Output is correct (P=0.028545, F=191.5, Q=304.1) -> 26.85 points

Test #22:

score: 27.24
Acceptable Answer
time: 143ms
memory: 3892kb

input:

1000 0.039856 300
P
P
P
P
P
P
P
N
P
P
N
P
P
N
N
P
N
P
N
P
N
P
P
N
P
P
P
P
N
P
N
P
N
N
N
N
P
P
N
P
P
P
P
N
P
P
N
N
N
P
N
P
N
P
P
P
N
P
P
N
P
P
P
P
N
P
P
N
P
N
P
N
P
P
P
N
N
P
P
N
P
P
P
N
N
P
P
P
P
N
N
N
N
P
P
P
P
P
P
P
P
N
N
N
P
P
P
P
N
P
N
N
N
P
P
P
P
N
P
N
P
N
N
P
P
N
P
P
P
N
N
N
P
P
P
N
P
N
P
P
P
...

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 0.30266666670 0.3026666667 Output is correct (P=0.039856, F=246.3, Q=388.2) -> 27.24 points

Test #23:

score: 27.96
Acceptable Answer
time: 289ms
memory: 3816kb

input:

1000 0.068648 300
P
P
P
P
P
P
P
N
P
N
P
N
P
N
P
P
P
P
N
P
N
P
P
N
P
N
P
P
P
P
P
N
N
N
P
P
P
N
P
P
N
P
P
P
N
P
P
P
P
N
N
N
P
P
P
P
N
P
N
P
N
P
P
N
N
P
P
P
N
P
N
P
N
P
P
N
P
P
N
P
N
P
N
P
N
P
P
P
P
P
P
N
N
N
N
P
N
P
P
N
P
P
N
N
P
P
P
N
P
P
P
P
N
P
N
N
N
N
P
P
N
P
N
P
P
P
N
P
N
N
P
P
P
P
N
P
P
P
P
P
P
...

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 0.31066666670 0.3106666667 Output is correct (P=0.068648, F=366.2, Q=569.3) -> 27.96 points

Test #24:

score: 51.75
Acceptable Answer
time: 332ms
memory: 3888kb

input:

1000 0.104571 300
N
N
N
N
N
P
P
N
N
N
N
P
N
P
P
N
P
P
P
P
N
N
N
N
N
P
N
P
P
N
P
P
N
N
P
N
P
N
P
N
P
P
N
N
P
P
N
N
P
P
P
P
N
N
P
P
P
N
P
P
N
N
N
N
N
N
N
N
N
P
P
P
N
N
N
N
N
P
P
P
N
N
N
N
N
P
P
N
N
N
N
N
N
N
N
P
N
P
P
N
P
P
P
N
N
P
P
P
N
P
N
P
N
P
N
N
N
P
N
P
P
N
N
N
P
P
N
N
N
N
N
P
N
P
P
N
P
P
N
P
P
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.5750 0.575 Output is correct (P=0.104571, F=490.3, Q=580.9) -> 51.75 points

Test #25:

score: 59.23
Acceptable Answer
time: 257ms
memory: 3996kb

input:

1000 0.158765 300
N
N
N
N
P
P
P
N
N
P
N
P
P
N
N
N
P
P
P
P
N
N
N
N
N
N
N
N
N
P
P
N
P
N
N
N
N
N
P
P
N
N
N
N
P
N
P
N
N
N
N
P
N
P
N
N
P
N
P
N
N
N
P
N
P
P
N
N
N
N
P
P
N
N
P
P
P
N
N
P
P
N
N
N
P
P
P
N
N
N
N
N
N
N
P
P
N
P
P
P
N
N
P
P
N
N
N
N
N
N
N
P
P
N
N
N
P
N
P
N
P
N
P
P
P
P
P
N
N
P
P
N
N
N
P
P
P
N
N
P
P
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.65811111110 0.6581111111 Output is correct (P=0.158765, F=639.1, Q=722.1) -> 59.23 points

Test #26:

score: 70.61
Acceptable Answer
time: 283ms
memory: 3896kb

input:

1000 0.2 300
N
N
P
P
N
N
P
N
P
N
N
N
N
N
N
N
N
N
P
N
P
N
P
P
N
N
P
N
P
N
N
P
P
N
P
P
N
N
P
P
N
P
P
N
N
P
P
P
N
N
P
N
N
P
P
N
N
N
N
N
N
N
P
N
P
P
P
N
N
P
N
N
N
P
N
N
P
N
N
P
N
N
N
N
N
N
N
P
N
P
N
P
P
N
P
N
N
N
N
P
P
P
P
N
N
P
P
N
N
N
P
P
N
P
P
N
P
P
N
N
N
N
N
N
N
P
P
P
P
P
N
P
N
N
N
N
P
N
N
N
N
N
N
P...

output:

Q 1100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.78455555560 0.7845555556 Output is correct (P=0.2, F=731.4, Q=781.6) -> 70.61 points