QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#504814#9162. COVID testskwongweng#0 4252ms3768kbC++173.4kb2024-08-04 16:21:152024-08-04 16:21:16

Judging History

你现在查看的是最新测评结果

  • [2024-08-04 16:21:16]
  • 评测
  • 测评结果:0
  • 用时:4252ms
  • 内存:3768kb
  • [2024-08-04 16:21:15]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef vector<vector<ll>> vll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
#define ms memset
#define fi first
#define se second

ll MOD = 998244353;
ll power(ll base, ll n){
    base %= MOD;
    if (n==0) return 1;
    ll halfn = power(base,n/2);
    if (n%2==0) return (halfn*halfn)%MOD;
    return (((halfn*halfn)%MOD)*base)%MOD;
}

ll inverse(ll n){
    return power(n,MOD-2);
}

ll C[3001][3001];
ll binom(int n, int k){
    if (C[n][k]!=-1) return C[n][k];
    if (n<k) return C[n][k] = 0;
    if (k==0) return C[n][k] = 1;
    return C[n][k] = (binom(n-1,k)+binom(n-1,k-1)) % MOD;
}

vll mul(vll A, vll B){
    int n = A.size();
    int m = B[0].size();
    int p = B.size();
    vll C; C.resize(n, vector<ll>(m,0LL));
    FOR(i,0,n){
        FOR(j,0,m){
            FOR(k,0,p){
                C[i][j] += (A[i][k]*B[k][j]) % MOD;
                C[i][j] %= MOD;
            }
        }
    }
    return C;
}

vll exp(vll base, ll n){
    int len = base.size();
    vll ans; ans.resize(len,vector<ll>(len,0LL));
    FOR(i,0,len) ans[i][i]=1;
    if (n==0) return ans;
    if (n==1) return base;
    ans = mul(exp(base,n/2),exp(base,n/2));
    if (n % 2 == 1) ans = mul(ans,base);
    return ans;
}

/*
bipartite -> Alice wins

*/

const int N = 1000;
vi p(N), sz(N);
set<int> par;

int get(int a){
    if (p[a]==a) return a;
    return p[a]=get(p[a]);
}

void Union(int a, int b){
    int c = get(a), d = get(b);
    if (sz[c]<sz[d]) swap(c,d);
    sz[c]+=sz[d];
    p[d]=c; par.erase(d);
}

ll INF = 1e9;
ll f(ll n){
    return ((n*(n+1))/2) % MOD;
}

int n;
vector<bool> val(N);

bool qry(){
    cout<<"Q "; FOR(i,0,n) cout<<val[i];
    cout<<endl;
    char ans; cin>>ans;
    return (ans=='N');
}

void print(){
    cout<<"A "; FOR(i,0,n) cout<<1-val[i];
    cout<<endl;
}

void find_positive(int L, int R){
    if (L>R) return;
    FOR(i,L,R+1){
        val[i]=true;
    }
    if (qry()) return;
    int l = L-1, r = R;
    while (r-l>1){
        int mid = (l+r)/2;
        FOR(i,l+1,mid+1) val[i] = true;
        FOR(i,mid+1,r+1) val[i] = false;
        if (qry()) l=mid;
        else r=mid;
    }
    FOR(i,L,r) val[i]=true;
    val[r] = false;
    if (r==R) return;
    find_positive(r+1,R);
}

void solve(){
    double p; int t; cin>>n>>p>>t;
    int v = floor(n*p);
    while (t--){
        FOR(i,0,n) val[i]=false;
        if (true){
            FOR(i,0,n/2){
                val[2*i]=true; val[2*i+1]=true;
                if (qry()) continue;
                val[2*i+1] = false;
                if (qry()) continue;
                val[2*i]=false; val[2*i+1]=true;
            }
            print();
            char verdict; cin>>verdict;
            if (verdict=='W') break;
            continue;
        }
        FOR(i,0,v) find_positive(i*(n/v), (i+1)*(n/v)-1);
        find_positive(v*(n/v),n-1);
        print();
        char verdict; cin>>verdict;
        if (verdict=='W') break;
    }


}

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int TC = 1; //cin>>TC;
    while (TC--){
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 28ms
memory: 3764kb

input:

1000 0.789673 1
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
...

output:

Q 1100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.0 0.0 translate:wrong

Subtask #2:

score: 0
Wrong Answer

Test #18:

score: 0
Wrong Answer
time: 4252ms
memory: 3768kb

input:

1000 0.001 300
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N
N...

output:

Q 1100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.0 0.0 translate:wrong