Submission #1044190

# Submission time Handle Problem Language Result Execution time Memory
1044190 2024-08-05T07:55:54 Z gagik_2007 COVID tests (CEOI24_covid) C++17
7.8 / 100
7000 ms 4268 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;
int DIV=50;

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 Execution timed out 7063 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 4268 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 134 ms 520 KB Output is correct (P=0.001, F=15.1, Q=54.9) -> 7.80 points
2 Correct 201 ms 812 KB Output is correct (P=0.005256, F=51.1, Q=77.1) -> 29.65 points
3 Correct 261 ms 800 KB Output is correct (P=0.011546, F=94.9, Q=110.2) -> 54.71 points
4 Correct 488 ms 1428 KB Output is correct (P=0.028545, F=191.5, Q=197.6) -> 79.83 points
5 Correct 658 ms 2024 KB Output is correct (P=0.039856, F=246.3, Q=255.5) -> 78.30 points
6 Correct 999 ms 2068 KB Output is correct (P=0.068648, F=366.2, Q=394.6) -> 68.69 points
7 Correct 1416 ms 2528 KB Output is correct (P=0.104571, F=490.3, Q=561.8) -> 56.84 points
8 Correct 1746 ms 2228 KB Output is correct (P=0.158765, F=639.1, Q=798.1) -> 45.11 points
9 Correct 2195 ms 2740 KB Output is correct (P=0.2, F=731.4, Q=990.5) -> 37.24 points