QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#528769#9162. COVID testsmakrav#60.04 330ms4044kbC++204.3kb2024-08-23 21:01:372024-08-23 21:01:37

Judging History

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

  • [2024-08-23 21:01:37]
  • 评测
  • 测评结果:60.04
  • 用时:330ms
  • 内存:4044kb
  • [2024-08-23 21:01:37]
  • 提交

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
        };

        string ans, req;
        for (int i = 0; i < n; i++) {
            ans += '0';
            req += '0';
        }
        auto solve = [&](int l, int r, bool need_check, auto&&solve) -> bool {
            if (need_check) {
                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 false;
            }
            if (l + 1 == r) {
                ans[l] = '1';
                return true;
            }
            if (l + 2 == r) {
                req[l] = '1';
                bool rs = ask(req);
                if (!rs) {
                    ans[l + 1] = '1';
                    req[l] = '0';
                    return true;
                }
                ans[l] = '1';
                req[l] = '0';
                req[l + 1] = '1';
                if (ask(req)) ans[l + 1] = '1';
                req[l + 1] = '0';
                return true;
            }   
            int m = (l + r) / 2;
            bool nch = solve(l, m, true, solve);
            solve(m, r, nch, solve);
            return true;
        };
        if (p >= 0.158765) {
            int K = 3;
            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) {
                    solve(i, min(n, i + K), false, solve);
                }
            }
            assert(check(ans));
        } else if (p >= 0.068648) {
            int K = 10;
            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) {
                    solve(i, min(i + K, n), false, solve);
                }
            }
            assert(check(ans));
        } else if (p == 0.001) {
            solve(0, n, true, solve);
            assert(check(ans));   
        } else {
            int K = 50;
            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) {
                    solve(i, min(i + K, n), false, 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: 17ms
memory: 3764kb

input:

1000 0.789673 1
P
P
P
N
P
P
P
P
P
P
P
P
P
N
P
P
P
P
N
P
P
P
N
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
N
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
N
N
P
P
P
P
N
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
N
P
P
P
N
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
...

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #2:

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

input:

1000 0.686378 1
P
N
P
N
P
N
N
P
N
N
P
N
P
P
P
N
N
P
P
P
P
P
P
N
P
P
P
P
P
N
P
P
P
P
N
P
N
P
N
P
P
P
P
P
N
P
P
P
N
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
N
N
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
N
P
N
P
P
P
N
P
N
P
P
P
P
P
P
P
P
P
N
P
P
N
P
P
P
P
P
P
N
P
N
P
N
P
N
...

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #3:

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

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
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
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
N
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
...

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #4:

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

input:

1000 0.669578 1
P
P
P
P
N
P
P
P
P
P
P
P
P
P
N
P
P
P
N
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
N
N
P
N
P
N
P
P
P
P
N
P
P
P
P
N
P
P
P
P
N
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
N
N
P
P
P
N
P
P
N
P
P
P
P
N
P
N
P
N
P
P
P
N
P
N
P
P
P
N
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
N
P
P
...

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #5:

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

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
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
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
N
P
P
P
P
P
P
P
P
N
...

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #6:

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

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
N
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
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
P
P
P
N
P
P
P
P
P
P
N
P
N
P
P
P
P
N
P
P
P
P
...

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #7:

score: 10
Accepted
time: 2ms
memory: 4008kb

input:

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

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #8:

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

input:

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

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #9:

score: 10
Accepted
time: 2ms
memory: 3852kb

input:

1000 0.596017 1
P
P
P
N
P
P
N
P
P
N
P
P
P
P
P
P
N
P
N
P
N
P
P
P
P
P
N
P
N
P
N
P
N
N
P
N
N
P
N
N
P
N
P
P
P
P
P
N
P
P
P
N
P
P
P
P
N
P
P
P
N
P
P
P
P
N
P
P
N
P
P
P
P
P
P
N
P
N
P
N
N
N
P
P
P
P
P
P
N
P
P
P
P
N
P
P
N
P
P
P
P
N
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
P
P
P
N
P
N
P
P
P
P
P
P
P
...

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #10:

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

input:

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

output:

Q 1111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #11:

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

input:

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

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #12:

score: 10
Accepted
time: 2ms
memory: 3764kb

input:

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

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #13:

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

input:

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

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #14:

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

input:

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

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #15:

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

input:

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

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #16:

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

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 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #17:

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

input:

1000 0 1
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
C

output:

Q 1111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Subtask #2:

score: 50.04
Acceptable Answer

Test #18:

score: 90
Accepted
time: 12ms
memory: 3824kb

input:

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

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 1.0 1.0 Output is correct (P=0.001, F=15.1, Q=13.8) -> 90.00 points

Test #19:

score: 50.04
Acceptable Answer
time: 36ms
memory: 3816kb

input:

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

output:

Q 1111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.5560 0.556 Output is correct (P=0.005256, F=51.1, Q=61.3) -> 50.04 points

Test #20:

score: 56.75
Acceptable Answer
time: 42ms
memory: 3852kb

input:

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

output:

Q 1111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.63055555560 0.6305555556 Output is correct (P=0.011546, F=94.9, Q=108.8) -> 56.75 points

Test #21:

score: 53.81
Acceptable Answer
time: 76ms
memory: 3976kb

input:

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

output:

Q 1111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.59788888890 0.5978888889 Output is correct (P=0.028545, F=191.5, Q=223.7) -> 53.81 points

Test #22:

score: 52.49
Acceptable Answer
time: 96ms
memory: 3876kb

input:

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

output:

Q 1111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.58322222220 0.5832222222 Output is correct (P=0.039856, F=246.3, Q=290.3) -> 52.49 points

Test #23:

score: 65.21
Acceptable Answer
time: 151ms
memory: 3760kb

input:

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

output:

Q 1111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.72455555560 0.7245555556 Output is correct (P=0.068648, F=366.2, Q=401.0) -> 65.21 points

Test #24:

score: 66.55
Acceptable Answer
time: 154ms
memory: 3828kb

input:

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

output:

Q 1111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.73944444440 0.7394444444 Output is correct (P=0.104571, F=490.3, Q=533.5) -> 66.55 points

Test #25:

score: 75.93
Acceptable Answer
time: 234ms
memory: 3820kb

input:

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

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.84366666670 0.8436666667 Output is correct (P=0.158765, F=639.1, Q=668.7) -> 75.93 points

Test #26:

score: 81.57
Acceptable Answer
time: 330ms
memory: 3824kb

input:

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

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.90633333330 0.9063333333 Output is correct (P=0.2, F=731.4, Q=750.3) -> 81.57 points