QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#528518 | #9162. COVID tests | Mispertion# | 39.52 | 1115ms | 4052kb | C++23 | 2.5kb | 2024-08-23 15:37:30 | 2024-08-23 15:37:31 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
#define int ll
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define mispertion ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define F first
#define S second
#define getlast(s) (*s.rbegin())
#define debg cout << "OK\n"
const ld PI = 3.1415926535;
const int N = 2e5 + 10;
const int M = 1e5 + 10;
int mod = 998244353;
const int infi = INT_MAX;
const ll infl = 1e16;
const int P = 2;
int mult(int a, int b){
return a * 1LL * b % mod;
}
int sum(int a, int b){
if(a + b >= mod)
return a + b - mod;
if(a + b < 0)
return a + b + mod;
return a + b;
}
int binpow(int a, int n){
if (n == 0)
return 1;
if (n % 2 == 1){
return mult(binpow(a, n - 1), a);
}
else{
auto b = binpow(a, n / 2);
return mult(b, b);
}
}
int n, ans[N], bl = 4;
double p;
int ask(string s){
cout << "Q " << s << endl;
char c;
cin >> c;
return (c == 'P');
}
void getans(int l, int r){
if(l > r)
return;
string zer = "";
for(int i = 1; i <= n; i++)
zer += "0";
if(r - l < bl - 1){
for(int i = l; i <= r; i++){
zer[i - 1] = '1';
ans[i] = ask(zer);
zer[i - 1] = '0';
}
return;
}
string req = "";
for(int i = 1; i < l; i++)
req += "0";
for(int i = 1; i <= r - l + 1; i++)
req += "1";
for(int i = 1; i <= n - r; i++){
req += "0";
}
if((l == 1 && r == n) || ask(req)){
int len = (r - l + 1) / bl;
int ost = (r - l + 1) % bl;
for(int i = 0; i < ost; i++, l += len + 1)
getans(l, l + len);
for(int i = 0; i < bl - ost; i++, l += len)
getans(l, l + len - 1);
}
}
void solve(){
for(int i = 1; i <= n; i++)
ans[i] = 0;
getans(1, n);
cout << "A ";
for(int i = 1; i <= n; i++)
cout << ans[i];
cout << endl;
char c;
cin >> c;
if(c == 'W')
exit(0);
}
signed main(){
mispertion;
int t = 1;
cin >> n >> p;
cin >> t;
while (t--){
solve();
}
return 0;
}
详细
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 3860kb
input:
1000 0.789673 1 P P P P P N P P P P P P P P N P P N P P N P P P P P P P N 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 N N N P P P P P P P N P P P P P N N P P P N P P P P P P P P N P P P P P P N N P P N 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 N N P P N P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #2:
score: 10
Accepted
time: 11ms
memory: 3820kb
input:
1000 0.686378 1 P P P P N P N N P N P N N P P N P P P N N P P P P P P N P P P P N P P P P N N P P N P P P P P N N N P P N P P P P N P P P P P P P P P N N 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 N N P P P N N N P P P P N P P N P P P P P P N P P N N P P P P P N P N P N P N P P P P P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #3:
score: 10
Accepted
time: 4ms
memory: 3852kb
input:
1000 0.873862 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 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 P N 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 N P P P P N P P P N P P P P P P P P P N 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 ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #4:
score: 10
Accepted
time: 3ms
memory: 3880kb
input:
1000 0.669578 1 P P P P P P N P P P P P P P N P N P P P P N P P P P P P P P P P N P P P P P N P N P N P P P N P P N P P P N P P P N P N P P P P P P P P P P P P P P P P P P N N P P N P P P P P N N P P P N N P P N P N P P N P P N P P N P P P P P P P P P P P P N P P P N P P P P N P P P P P P P P N P P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #5:
score: 10
Accepted
time: 7ms
memory: 3816kb
input:
1000 0.907052 1 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 N P P P P P N 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 N P P P P P P P N P P P P P P P P P P P P N P P P P P P P P P P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #6:
score: 10
Accepted
time: 0ms
memory: 3820kb
input:
1000 0.844418 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 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 N P P P P P P N P P P P P P N P P P P P P N P P P P P P P P N P P P P P N P P N P P N P P P P N P P P N P P P P P N N P N P P P P P N N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #7:
score: 10
Accepted
time: 9ms
memory: 3876kb
input:
1000 0.533576 1 P P P P P P P N P N N N P P P N N P P N P N P P P P N P N P N P N P P N P P N P P N P N P P P P P P P N N N P P P P P P P N N P P P P N P P P P P P N P P P P P N N N N P P P N P N P P P P N P P N P P P P N P P P P P P N P N P P P N N P P N N P P N P P N P P N P N P P P N N P P N N P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #8:
score: 10
Accepted
time: 10ms
memory: 4048kb
input:
1000 0.415944 1 P P P N P N N N P P N N P N P N P N P P P N N N P N N P N P N N P P N N P P P P P N P P N N P N P N P N N P P P P N P P P P N N P P N P N N N N P P P N P N P P N P N P P N N N P N P P P N N P P P P P P P N N N P P P N N N P P P N N P P N P P P P N P P N P P P P N P P P N P P P P P P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #9:
score: 10
Accepted
time: 6ms
memory: 4016kb
input:
1000 0.596017 1 P P P P P N P P P N N P N P N P P P P N P N N P P P P P N P P N P N P N N P N P N P N N P P P N P P P P N P P P N P P P P N P N P P P P P N P P N N P P P P N P N N N P P P P N N N P P P P N P P P P N N P P N N P P P P N N P P N P N N P P N N P P N P P N P P N P P P P P N P P P P N N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #10:
score: 10
Accepted
time: 11ms
memory: 3976kb
input:
1000 0.157686 1 P P P N N N P N P N N P P N P P N P N P N N P N N P N N P N P N N P N P N N P P P N N P N P P P N N N P N N P N N N N N P P N N P N N P N N P N N P N N P P N P P N N N P P P N N N N P N N P P P P P P N N N N N N N P P N P N P N N P P N N N P N N P N P N P P N N N N P P N N N P N N P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #11:
score: 10
Accepted
time: 5ms
memory: 4016kb
input:
1000 0.380215 1 P P P P N N N P P N N N P P N N P N P N N P P P P N P N N P N P P P P N P P N P N N P N P P N N P N P N N P P P P P N N P N N N P P P P N N N N N N N N P P P P P N N P N N P P P N N N P N P P N P N P P N N P N P N N N P N P P P P P P P P P P N N N P P N P N N P P N N N P P N N N N N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #12:
score: 10
Accepted
time: 7ms
memory: 3828kb
input:
1000 0.432565 1 P P P P P N P N P N P N N P N P P P P N P P N P N N P P P P N P P P N N P P P P P P P N P P N P N N N P P P P P N P P P N N P P P P N N P N N P N P N P P P P N P N P P P N N P P N N P N P N N P N P P P N N N P P N N P P N P N N P N P N N P P P P P P P P P N P N P N N N P P P P N P N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #13:
score: 10
Accepted
time: 13ms
memory: 3820kb
input:
1000 0.509199 1 P P P P P P N P P N N N P P P N N N P N N P N P P N P P N P P P N P P P P P P P N N P N P P P P N P P P P P P P P P P P P P N P P P P P N N P P N P P N P P N P N N P N P P P P N P N N P P P N N P N P P P P P N N P P P P P N N P N N P P P N P N N P P N P P P P P P N N P N P P N P P P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #14:
score: 10
Accepted
time: 8ms
memory: 3880kb
input:
1000 0.381646 1 P P P P N N N P N P P P P N N P P P N N N P P N P N P P N P N N P P N N P P N P P P N N P N N N P P N P P N P N P N N N P P P N P P P P P N P P P P N P P N P P P N P P N P N N P P P N P P P N P P N P P P P N N P P N N N P N N P N P N P P N P N P P P N P P N N P N N N P P P P P N N P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #15:
score: 10
Accepted
time: 5ms
memory: 3812kb
input:
1000 0.42815 1 P P P P N P P N P P N P P P P N N P P N N P N P P N P P P N P P P P N P N N P P P P N P N N P P N N N P P P N N P N N P N P P N P P N P P N N N P N P N N N N N P P P P N P P P N P P P P P N N N P P P P N P P P P P N P P P N P P N N N P P N N P N P P N P P N P P P N N P P N N P P P P P...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #16:
score: 10
Accepted
time: 5ms
memory: 3928kb
input:
1000 1 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 P P P P...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #17:
score: 10
Accepted
time: 1ms
memory: 3872kb
input:
1000 0 1 N N N N C
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Subtask #2:
score: 29.52
Acceptable Answer
Test #18:
score: 47.35
Acceptable Answer
time: 40ms
memory: 3848kb
input:
1000 0.001 300 N N N N C N N P N N N P P N P P N N N N N N N N N C N N N P N P N P P N N N P N N N N P N N P N P N N N N N P N P N N P P N N N N N N N C N N N N C N N N N C N P N P N P N N P N N P N N N N N N N N C N N N P P N P N N N P N N P N N N N N N C N N N N C N N N N C N P P P N N P N N P N N...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 0.52611111110 0.5261111111 Output is correct (P=0.001, F=15.1, Q=18.5) -> 47.35 points
Test #19:
score: 31.52
Acceptable Answer
time: 70ms
memory: 3832kb
input:
1000 0.005256 300 P N P N P N N N P N N P N P N N P P N N N N N N N P N N N P P N P N P N N N N N N N N P P N P N N N P N N N P N N N N P N P P N N P N N N N N N C N N P N P N N P N N P N N P N N N N N P N P N N P N N P N P N N N N P N N P P P N N N N N N N N N N C N N N P N N P N N P N N N P N N N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 0.35022222220 0.3502222222 Output is correct (P=0.005256, F=51.1, Q=74.8) -> 31.52 points
Test #20:
score: 29.52
Acceptable Answer
time: 231ms
memory: 3820kb
input:
1000 0.011546 300 P P N P P P N N N N P N P N N N N N N N P N N N P N P P N N N N N N N P P N N N P N P N P N P P N P N N N N N P N P N P N N P N N P N N P N N N N N N P P N N N P N N P N N N P N N N P N N P N N P P N N N N N P N N N P N N N N N P P N P N N N P N N P N N N C P N P N N P P N N P N N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 0.3280 0.328 Output is correct (P=0.011546, F=94.9, Q=143.5) -> 29.52 points
Test #21:
score: 30.48
Acceptable Answer
time: 361ms
memory: 3888kb
input:
1000 0.028545 300 P P P P P N N N N N N N N N P N P P P N N N N N N N N P P N N P N P N N P N P N N N N N P N P N P N N P N P N N P N N N P N P N P N N N N N N P N P N P N P N N N P N N P N N N P P N N N P N N P N N N P N N N P P N N P N P N N N P N N N P N N N P P P P N N N P N N N P N P N N N P N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 0.33866666670 0.3386666667 Output is correct (P=0.028545, F=191.5, Q=285.0) -> 30.48 points
Test #22:
score: 31.46
Acceptable Answer
time: 485ms
memory: 3816kb
input:
1000 0.039856 300 P P P N N P N P N N N P N N N P N P N N P P N P N N N N N N N P N P N N N P N N N P N P N N P N N P N P N N P P P N N N P N P N N P N N P P N N P N P N N P N N N N N P P P P P N N N N N N P P P N N N N N N P P N P N N N N N P P N N P N N N N N N P P N N P N N P N N N N N P N N N P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 0.34955555560 0.3495555556 Output is correct (P=0.039856, F=246.3, Q=360.9) -> 31.46 points
Test #23:
score: 34.04
Acceptable Answer
time: 663ms
memory: 3880kb
input:
1000 0.068648 300 P P P N N N P N N P N P P N N P N P N N P P N N P P N N N P P P N P N N P N N N P P N P P N N N N N N N P P N N N P P N N N P N P N P N N N P N N P N N P N N P P N N N N N N P P N N N P N N N P N N N P N P N P N N N P N N P P P P P N N N N N N P P N P N N N N N N N P P P N P N N P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 0.37822222220 0.3782222222 Output is correct (P=0.068648, F=366.2, Q=516.7) -> 34.04 points
Test #24:
score: 37.17
Acceptable Answer
time: 785ms
memory: 4016kb
input:
1000 0.104571 300 P P N P N P N P N N N N P P N N P N P P P N N N N P N N P N N P N N P N P P N P P N N P N P N N P N P P N P P N N P N P N P N N P N N N N P N P P N N N P N N P N P N N N P N N N P N P N N N N P N P P P P N N N P P N N P P N N N P N P N P N N P N N N P P N P N N N N N N N P P N N N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 0.4130 0.413 Output is correct (P=0.104571, F=490.3, Q=664.5) -> 37.17 points
Test #25:
score: 41.24
Acceptable Answer
time: 1066ms
memory: 3816kb
input:
1000 0.158765 300 P P N P P P N N N P N N P N N N P P P P N N N N N N P P N P N N P N P P N N N N P N N P N N P N N P N N P P N N N N P N N P P N N N N N N P P P N P N N N N P P N N N P N N P N N N P P N N P N P P N N N P N P N N P N N N N N P P N P N P P P N N P P N P N N N N N P N N P N P N N N N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 0.45822222220 0.4582222222 Output is correct (P=0.158765, F=639.1, Q=828.0) -> 41.24 points
Test #26:
score: 43.44
Acceptable Answer
time: 1115ms
memory: 4052kb
input:
1000 0.2 300 P P P N P P N N N P N P N P N P N N N P N P N P P P P N N N P N P N P P N N P N P P N N N P P P N P N P N N P P N N P N P P P N P N N N N N P P P P P N N P P N N N P N N P N P P N N P N P N N P N N N P N P P N P P P N N P N N N N P P P N N P P P N P N N P P N N N P N N P N P P P N P N N...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000...
result:
points 0.48266666670 0.4826666667 Output is correct (P=0.2, F=731.4, Q=927.4) -> 43.44 points