QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#504686#9162. COVID testskwongweng#0 3001ms5608kbC++172.9kb2024-08-04 14:48:202024-08-04 14:48:21

Judging History

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

  • [2024-08-04 14:48:21]
  • 评测
  • 测评结果:0
  • 用时:3001ms
  • 内存:5608kb
  • [2024-08-04 14:48:20]
  • 提交

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 = 2001;
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;
}

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

vi find_positive(int n, int L, int R){
    vi ans(R-L+1);
    if (qry(n,L,R)) return ans;
    int l = L-1, r = R;
    while (r-l>1){
        int mid = (l+r)/2;
        if (qry(n,L,mid)){
            l = mid;
        }else{
            r = mid;
        }
    }
    ans[r-L] = 1;
    if (r==R) return ans;
    vi nxt = find_positive(n,r+1,R);
    FOR(i,r-L+1,R-L+1){
        ans[i] = nxt[i-(r-L+1)];
    }
    return ans;
}

void solve(){
    int n; double p; int t; cin>>n>>p>>t;
    while (t--){
        vi answer = find_positive(n,0,n-1);
        cout<<"A "; FOR(i,0,n) cout<<answer[i];
        cout<<endl;
        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: 181ms
memory: 5608kb

input:

1000 0.789673 1
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
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
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
N
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 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 0.0 0.0 translate:wrong

Subtask #2:

score: 0
Time Limit Exceeded

Test #18:

score: 90
Accepted
time: 91ms
memory: 4008kb

input:

1000 0.001 300
N
C
P
N
P
N
N
P
P
P
N
N
P
N
C
P
N
N
P
N
P
N
P
N
P
N
P
P
P
N
N
N
P
N
N
P
P
P
N
N
N
P
N
N
C
N
C
N
C
P
P
N
P
N
P
N
N
N
P
P
N
C
P
N
N
P
P
P
N
N
N
N
N
N
C
N
C
N
C
P
P
N
P
P
P
P
N
P
N
N
N
C
N
C
P
N
N
P
N
P
N
P
P
N
N
P
P
N
N
P
P
N
N
N
N
C
P
N
P
N
P
P
N
N
P
P
N
P
P
P
N
N
P
P
N
N
P
P
N
P
P
P
P...

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 1.0 1.0 Output is correct (P=0.001, F=15.1, Q=10.7) -> 90.00 points

Test #19:

score: 78.89
Acceptable Answer
time: 398ms
memory: 4084kb

input:

1000 0.005256 300
P
P
P
P
N
N
P
P
P
P
P
P
P
P
P
P
P
P
N
P
N
N
P
P
N
N
P
P
P
P
N
P
P
P
N
P
P
N
N
P
N
N
N
N
P
N
N
P
P
N
N
N
P
N
C
P
N
P
P
N
N
P
N
N
P
P
P
N
P
N
P
P
P
P
N
N
P
P
N
P
N
N
N
N
N
N
C
P
N
N
N
P
N
P
N
N
N
N
N
C
P
P
P
N
P
P
N
N
N
P
N
P
P
P
N
P
N
N
P
P
N
N
P
P
P
P
P
P
P
N
P
P
P
N
P
N
P
N
P
P
N
...

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 0.87655555560 0.8765555556 Output is correct (P=0.005256, F=51.1, Q=52.9) -> 78.89 points

Test #20:

score: 49.63
Acceptable Answer
time: 904ms
memory: 4028kb

input:

1000 0.011546 300
P
P
P
P
P
P
N
P
P
P
N
P
P
P
P
P
P
P
N
P
P
N
P
P
P
N
N
N
P
P
P
N
P
P
P
P
P
N
P
N
P
N
N
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
N
P
N
P
N
P
P
P
P
P
P
P
P
N
N
P
P
N
P
N
N
P
N
P
N
N
N
P
P
P
N
N
N
P
N
N
P
N
P
P
N
P
P
N
P
P
N
N
N
N
N
N
C
P
P
P
P
N
N
P
P
N
P
P
P
P
N
P
P
N
P
N
...

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 0.55144444440 0.5514444444 Output is correct (P=0.011546, F=94.9, Q=114.2) -> 49.63 points

Test #21:

score: 32.18
Acceptable Answer
time: 2185ms
memory: 4160kb

input:

1000 0.028545 300
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
N
P
P
P
N
P
P
P
P
P
N
N
N
N
N
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
N
P
N
P
N
P
N
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
N
P
P
P
N
P
P
P
P
N
P
P
P
P
P
N
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
N
P
N
N
N
P
P
P
P
P
P
N
P
N
N
P
P
P
P
P
P
N
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
...

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 0.35755555560 0.3575555556 Output is correct (P=0.028545, F=191.5, Q=277.5) -> 32.18 points

Test #22:

score: 27.17
Acceptable Answer
time: 3001ms
memory: 3960kb

input:

1000 0.039856 300
P
P
P
P
P
P
P
N
P
N
P
P
P
P
P
P
P
N
P
N
P
N
P
P
P
P
P
P
P
P
N
P
P
P
P
P
N
P
P
P
P
N
P
P
P
P
P
P
P
P
N
N
N
N
N
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
N
N
N
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
N
P
N
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
N
N
P
N
P
P
P
P
P
P
P
N
P
N
N
P
P
P
P
P
P
P
N
N
P
P
P
P
...

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 0.30188888890 0.3018888889 Output is correct (P=0.039856, F=246.3, Q=388.7) -> 27.17 points

Test #23:

score: 0
Time Limit Exceeded

input:

1000 0.068648 300
P
P
P
P
P
P
P
N
N
N
N
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
N
P
P
N
P
P
P
P
P
P
P
P
N
P
N
P
P
P
P
P
P
N
N
P
P
N
P
P
P
P
P
P
P
N
P
N
P
P
P
P
P
P
P
P
N
P
N
P
P
P
P
P
P
P
N
N
N
P
N
...

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result: