Submission #1044400

# Submission time Handle Problem Language Result Execution time Memory
1044400 2024-08-05T09:19:39 Z CyberCow COVID tests (CEOI24_covid) C++17
48.49 / 100
5567 ms 344 KB
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
#include <iostream>
using namespace std;

int N;
double P;

inline bool test_students(int &l, int &r) {
    cout << "Q ";
    for (int i = 0; i < l; i++)
    {
        cout << '0';
    }
    for (int i = l; i <= r; i++)
    {
        cout << '1';
    }
    for (int i = r + 1; i < N; i++)
    {
        cout << '0';
    }
    cout << endl;
    char c;
    cin >> c;
    if (c == 'P')
        return 1;
    return 0;
}

vector<bool> answer;

inline void recus(int l, int r, int st)
{
    if (l == r)
    {
        if(test_students(l, r))
        {
            answer[l] = 1;
        }
    }
    else
    {
        int m = (l + r) / 2;
        int hm = test_students(l, m);
        if (hm == 0)
        {
            if (st == 0)
            {
                m++;
                hm = test_students(m, r);
                m--;
                if (hm == 1)
                {
                    if (m + 1 == r)
                    {
                        answer[r] = 1;
                    }
                    else
                    {
                        recus(m + 1, r, 1);
                    }
                }
            }
            else
            {
                if (m + 1 == r)
                {
                    answer[r] = 1;
                }
                else
                {
                    recus(m + 1, r, 1);
                }
            }
        }
        else
        {
            if (l != m)
                recus(l, m, 1);
            else
            {
                answer[l] = 1;
            }
            m++;
            hm = test_students(m, r);
            m--;
            if (hm == 1)
            {
                if (m + 1 != r)
                {
                    recus(m + 1, r, st);
                }
                else
                {
                    answer[m + 1] = 1;
                }
            }
        }
    }
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int T;
    cin >> N >> P >> T;
    vector<bool>zro;
    for (int i = 0; i < N; i++)
    {
        zro.push_back(0);
    }
    for (int i = 0; i < T; i++) {
        answer = zro;
        int intervalboooom = 334;
        for (int j = 0; j < N; j+=intervalboooom)
        {
            recus(j, min(j + intervalboooom - 1, N - 1), 0);
        }
        cout << "A ";
        for (int i = 0; i < answer.size(); i++)
        {
            cout << answer[i];
        }
        cout << endl;
        char c;
        cin >> c;
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:124:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  124 |         for (int i = 0; i < answer.size(); i++)
      |                         ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 344 KB Output is correct
2 Correct 46 ms 344 KB Output is correct
3 Correct 35 ms 344 KB Output is correct
4 Correct 37 ms 344 KB Output is correct
5 Correct 41 ms 344 KB Output is correct
6 Correct 45 ms 344 KB Output is correct
7 Correct 27 ms 344 KB Output is correct
8 Correct 23 ms 344 KB Output is correct
9 Correct 38 ms 344 KB Output is correct
10 Correct 14 ms 344 KB Output is correct
11 Correct 26 ms 344 KB Output is correct
12 Correct 27 ms 344 KB Output is correct
13 Correct 26 ms 344 KB Output is correct
14 Correct 23 ms 344 KB Output is correct
15 Correct 34 ms 344 KB Output is correct
16 Correct 45 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 107 ms 344 KB Output is correct (P=0.001, F=15.1, Q=16.4) -> 66.95 points
2 Correct 356 ms 344 KB Output is correct (P=0.005256, F=51.1, Q=60.0) -> 53.04 points
3 Correct 668 ms 344 KB Output is correct (P=0.011546, F=94.9, Q=118.0) -> 45.60 points
4 Correct 1385 ms 344 KB Output is correct (P=0.028545, F=191.5, Q=246.3) -> 41.96 points
5 Correct 1819 ms 344 KB Output is correct (P=0.039856, F=246.3, Q=318.9) -> 41.30 points
6 Correct 2762 ms 344 KB Output is correct (P=0.068648, F=366.2, Q=478.4) -> 40.44 points
7 Correct 3676 ms 344 KB Output is correct (P=0.104571, F=490.3, Q=640.5) -> 40.44 points
8 Correct 4749 ms 344 KB Output is correct (P=0.158765, F=639.1, Q=838.3) -> 40.06 points
9 Correct 5567 ms 344 KB Output is correct (P=0.2, F=731.4, Q=976.1) -> 38.49 points