답안 #1044185

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1044185 2024-08-05T07:54:13 Z gagik_2007 COVID tests (CEOI24_covid) C++17
17.45 / 100
7000 ms 5320 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=25;

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;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 7077 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 37 ms 5320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 600 KB Output is correct (P=0.001, F=15.1, Q=30.8) -> 17.45 points
2 Correct 130 ms 604 KB Output is correct (P=0.005256, F=51.1, Q=57.2) -> 60.91 points
3 Correct 228 ms 1000 KB Output is correct (P=0.011546, F=94.9, Q=96.0) -> 86.01 points
4 Correct 489 ms 1928 KB Output is correct (P=0.028545, F=191.5, Q=198.0) -> 79.24 points
5 Correct 686 ms 1460 KB Output is correct (P=0.039856, F=246.3, Q=264.0) -> 69.91 points
6 Correct 1107 ms 1712 KB Output is correct (P=0.068648, F=366.2, Q=425.0) -> 54.80 points
7 Correct 1587 ms 2160 KB Output is correct (P=0.104571, F=490.3, Q=620.1) -> 43.71 points
8 Correct 2295 ms 3008 KB Output is correct (P=0.158765, F=639.1, Q=898.1) -> 34.34 points
9 Correct 2397 ms 2692 KB Output is correct (P=0.2, F=731.4, Q=1129.3) -> 28.34 points