답안 #1068793

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1068793 2024-08-21T12:12:17 Z Benmath COVID tests (CEOI24_covid) C++14
10 / 100
30 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{  
    int ans[n];
        for(int i = 0; i < n; i++){
            ans[i] = 0;
        }
        double p1 = 0.10;
    if (p < p1){
    while(t--){
      
        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;
    }
    }else{
        for(int i = 0; i < n; i = i + 2){
            cout << "Q" << " ";
            for(int j = 0; j < n; j++){
                if(j == i or j == (i + 1)){
                    cout << "1";
                }else{
                    cout << "0";
                }
            }
            cout << endl << flush;
            cin >> x;
            if(x == 'P'){
                cout << "Q" << " ";
            for(int j = 0; j < n; j++){
                if(j == i){
                    cout << "1";
                }else{
                    cout << "0";
                }
            }
            cout << endl << flush;
            cin >> x;
            if(x == 'P'){
                ans[i] = 1;
            }
              cout << "Q" << " ";
            for(int j = 0; j < n; j++){
                if(j == (i +1)){
                    cout << "1";
                }else{
                    cout << "0";
                }
            }
            cout << endl << flush;
            cin >> x;
            if(x == 'P'){
                ans[i + 1] = 1;
            }
            }
        }
        cout << "A" << " ";
        for(int i = 0; i < n; i++){
            cout << ans[i];
        }
        cout << endl << flush;
        cin >> x;
    }
}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Unexpected end of file - token expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 344 KB Output is correct
2 Correct 20 ms 344 KB Output is correct
3 Correct 19 ms 344 KB Output is correct
4 Correct 22 ms 344 KB Output is correct
5 Correct 19 ms 340 KB Output is correct
6 Correct 30 ms 344 KB Output is correct
7 Correct 20 ms 344 KB Output is correct
8 Correct 19 ms 344 KB Output is correct
9 Correct 19 ms 344 KB Output is correct
10 Correct 25 ms 344 KB Output is correct
11 Correct 24 ms 344 KB Output is correct
12 Correct 19 ms 344 KB Output is correct
13 Correct 19 ms 344 KB Output is correct
14 Correct 28 ms 344 KB Output is correct
15 Correct 25 ms 344 KB Output is correct
16 Correct 21 ms 344 KB Output is correct
17 Correct 21 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -