Submission #1044178

# Submission time Handle Problem Language Result Execution time Memory
1044178 2024-08-05T07:52:56 Z gagik_2007 COVID tests (CEOI24_covid) C++17
20.7 / 100
3491 ms 6396 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define ff first
#define ss second

ll ttt;
const ll INF=1e18;
const ll MOD=1e9+7;
const ll N=5007;
ll n,m,k;
double p;
map<string, int>d;
const int DIV=10;

bool query(string s){
    if(d[s]){
        if(d[s]==1){
            return false;
        }
        return true;
    }
    cout<<"Q "<<s<<endl;
    char res;
    cin>>res;
    bool ress=false;
    if(res=='P'){
        ress=true;
    }
    d[s]=ress+1;
    return ress;
}

bool queryRange(int l, int r){
    string s="";
    for(int i=0;i<l;i++){
        s+='0';
    }
    for(int i=l;i<=r;i++){
        s+='1';
    }
    for(int i=r+1;i<n;i++){
        s+='0';
    }
    return query(s);
}

int findNextPositive(int from, int to){
    if(!queryRange(from, to)){
        return to+1;
    }
    int l=from;
    int r=to;
    while(l<r){
        int mid=(l+r)/2;
        if(queryRange(l, mid)){
            r=mid;
        }
        else{
            l=mid+1;
        }
    }
    return l;
}

void clear(){
    d.clear();
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // freopen("Binput.txt","r",stdin);
    // freopen("Boutput.txt","w",stdout);
    cin>>n>>p>>ttt;
    while(ttt--){
        clear();
        string ans="";
        for(int i=0;i<n;i++){
            ans+='0';
        }
        for(int fromm=0;fromm<n;fromm+=n/DIV){
            int from=fromm;
            int to=from+n/DIV-1;
            while(true){
                int ind=findNextPositive(from,to);
                if(ind==to+1){
                    break;
                }
                from=ind+1;
                ans[ind]='1';
                if(from>=to+1)break;
            }
        }
        cout<<"A "<<ans<<endl;
        char c;
        cin>>c;
        if(c=='W'){
            return 0;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 6396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 40 ms 344 KB Output is correct (P=0.001, F=15.1, Q=17.0) -> 59.87 points
2 Correct 129 ms 776 KB Output is correct (P=0.005256, F=51.1, Q=48.3) -> 90.00 points
3 Correct 242 ms 1072 KB Output is correct (P=0.011546, F=94.9, Q=94.2) -> 90.00 points
4 Correct 542 ms 1560 KB Output is correct (P=0.028545, F=191.5, Q=212.4) -> 62.65 points
5 Correct 713 ms 1788 KB Output is correct (P=0.039856, F=246.3, Q=291.2) -> 52.05 points
6 Correct 1294 ms 2232 KB Output is correct (P=0.068648, F=366.2, Q=480.8) -> 39.97 points
7 Correct 1610 ms 2144 KB Output is correct (P=0.104571, F=490.3, Q=716.5) -> 31.63 points
8 Correct 2394 ms 2708 KB Output is correct (P=0.158765, F=639.1, Q=1061.3) -> 24.71 points
9 Correct 3491 ms 2880 KB Output is correct (P=0.2, F=731.4, Q=1343.6) -> 20.70 points