Submission #1068328

# Submission time Handle Problem Language Result Execution time Memory
1068328 2024-08-21T09:18:49 Z Benmath COVID tests (CEOI24_covid) C++14
10 / 100
7000 ms 344 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    double p;
    cin >> p;
    int t;
    cin >> t;
    char x;
if(t == 1){
    while(t--){
        int pos[n];
        for(int i = 0; i < n; i++){
            cout << "Q" << " ";
            for(int j = 0; j < n; j++){
                if(j != i){
                    cout << "0";
                }else{
                    cout <<"1";
                }
            }
            cout << endl<<flush;
            cin >> x;
            if(x == 'P'){
                pos[i] = 1;
            }else{
                pos[i] = 0;
            }
    }
    cout << "A" <<" ";
    for(int i = 0; i < n; i++){
        cout<<pos[i];
    }
    cout << endl<<flush;
    cin >> x;

    }
}else{
    while(t--){
        int ans[n];
        for(int i = 0; i < n; i++){
            ans[i] = 0;
        }
        int t1 = 0;
        while(t1 == 0){

            cout << "Q" <<" ";
            for(int i = 0; i < n; i++){
                if(ans[i] == 1){
                    cout << "0";
                }else{
                cout << "1";}
            }
            cout << endl << flush;
            cin >> x;
            if(x == 'N'){
                t1++;
                break;
            }else{
            int l = 0;
            int r = n - 1;
                while(l < r){
                    int mid = (l + r)/2;
                    cout << "Q" << " ";
                    for(int i = 0; i < l; i++){
                        cout << "0";
                    }
                    for(int i = l; i <= mid; i++){
                        if(ans[i] == 1){
                            cout <<"0";
                        }else{
                        cout <<"1";}
                    }
                    for(int i = mid + 1; i < n; i++){
                        cout <<"0";
                    }
                    cout << endl << flush;
                    cin >> x;

                    if(x == 'P'){
                        r = mid;
                    }else{
                    l = mid + 1;}
                }
                ans[l] = 1;
            }
        }
        cout << "A" <<" ";
        for(int i = 0; i < n; i++){
            cout << ans[i];
        }
        cout << endl << flush;
        cin >> x;
    }
}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 344 KB Output is correct
2 Correct 19 ms 344 KB Output is correct
3 Correct 27 ms 344 KB Output is correct
4 Correct 34 ms 344 KB Output is correct
5 Correct 20 ms 344 KB Output is correct
6 Correct 20 ms 344 KB Output is correct
7 Correct 19 ms 344 KB Output is correct
8 Correct 20 ms 344 KB Output is correct
9 Correct 35 ms 344 KB Output is correct
10 Correct 27 ms 344 KB Output is correct
11 Correct 20 ms 344 KB Output is correct
12 Correct 19 ms 344 KB Output is correct
13 Correct 26 ms 344 KB Output is correct
14 Correct 25 ms 344 KB Output is correct
15 Correct 38 ms 344 KB Output is correct
16 Correct 25 ms 344 KB Output is correct
17 Correct 30 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 82 ms 344 KB Output is correct (P=0.001, F=15.1, Q=11.0) -> 90.00 points
2 Correct 397 ms 344 KB Output is correct (P=0.005256, F=51.1, Q=56.8) -> 62.23 points
3 Correct 848 ms 340 KB Output is correct (P=0.011546, F=94.9, Q=126.2) -> 38.81 points
4 Correct 2174 ms 344 KB Output is correct (P=0.028545, F=191.5, Q=313.4) -> 25.38 points
5 Correct 3123 ms 344 KB Output is correct (P=0.039856, F=246.3, Q=440.7) -> 21.65 points
6 Correct 5212 ms 344 KB Output is correct (P=0.068648, F=366.2, Q=758.9) -> 17.01 points
7 Execution timed out 7012 ms 344 KB Time limit exceeded (wall clock)
8 Halted 0 ms 0 KB -