답안 #1071337

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1071337 2024-08-23T06:46:43 Z jer033 COVID tests (CEOI24_covid) C++17
10 / 100
7000 ms 344 KB
#include <bits/stdc++.h>
using namespace std;

vector<bool> answer(1000, 0);

void answer_clear()
{
    answer = vector<bool> (1000, 0);
}

bool ask_query(vector<bool> a)
{
    cout << "Q ";
    for (int i=0; i<1000; i++)
        cout << a[i];
    cout << '\n';
    cout.flush();
    char x;
    cin >> x;
    if (x=='P')
        return 1;
    return 0;
}

bool report(vector<bool> a)
{
    cout << "A ";
    for (int i=0; i<1000; i++)
        cout << a[i];
    cout << '\n';
    cout.flush();
    char x;
    cin >> x;
    if (x=='C')
        return 1;
    return 0;
}

bool range_query(int x, int y)
{
    vector<bool> a(1000, 0);
    for (int i=x; i<=y; i++)
        a[i] = 1;
    bool response = ask_query(a);
    if (response==1)
    {
        if (x==y)
            answer[x] = 1;
        else
        {
            int z = (x+y)/2;
            range_query(x, z);
            range_query(z+1, y);
        }
        return 1;
    }
    return 0;
}

int main()
{
    int N, T;
    long double P;
    cin >> N >> P >> T;
    if (T==1)
    {
        while (T--)
        {
            vector<bool> query(N, 0);
            vector<bool> ans(N, 0);
            for (int i=0; i<N; i++)
            {
                query[i] = 1;
                ans[i] = ask_query(query);
                query[i] = 0;
            }
            bool L = report(ans);
            if (L==0)
                T = 0;
        }
    }
    else
    {
        while (T--)
        {
            answer_clear();
            range_query(0, 999);
            bool L = report(answer);
            if (L==0)
                T = 0;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 344 KB Output is correct
2 Correct 38 ms 344 KB Output is correct
3 Correct 47 ms 344 KB Output is correct
4 Correct 40 ms 344 KB Output is correct
5 Correct 37 ms 344 KB Output is correct
6 Correct 37 ms 344 KB Output is correct
7 Correct 44 ms 344 KB Output is correct
8 Correct 53 ms 344 KB Output is correct
9 Correct 47 ms 344 KB Output is correct
10 Correct 36 ms 344 KB Output is correct
11 Correct 40 ms 344 KB Output is correct
12 Correct 36 ms 344 KB Output is correct
13 Correct 60 ms 344 KB Output is correct
14 Correct 40 ms 344 KB Output is correct
15 Correct 36 ms 344 KB Output is correct
16 Correct 37 ms 344 KB Output is correct
17 Correct 41 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 222 ms 344 KB Output is correct (P=0.001, F=15.1, Q=17.8) -> 52.47 points
2 Correct 976 ms 344 KB Output is correct (P=0.005256, F=51.1, Q=78.0) -> 28.98 points
3 Correct 1857 ms 344 KB Output is correct (P=0.011546, F=94.9, Q=150.0) -> 27.09 points
4 Correct 3687 ms 344 KB Output is correct (P=0.028545, F=191.5, Q=303.5) -> 26.95 points
5 Correct 4753 ms 344 KB Output is correct (P=0.039856, F=246.3, Q=388.5) -> 27.20 points
6 Correct 6746 ms 344 KB Output is correct (P=0.068648, F=366.2, Q=569.4) -> 27.95 points
7 Execution timed out 7065 ms 344 KB Time limit exceeded
8 Halted 0 ms 0 KB -