QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#528519 | #9162. COVID tests | Mispertion# | 33.77 | 899ms | 4016kb | C++23 | 2.5kb | 2024-08-23 15:37:51 | 2024-08-23 15:37:52 |
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 = 5;
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;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 5ms
memory: 4004kb
input:
1000 0.789673 1 P P P P N P P P P P P P N P P N P N 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 P P P P P P P P P N N N P P P P P N P P P P P N N P P P N 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 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 P P P P P P P P N P N P P P N P P N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #2:
score: 10
Accepted
time: 3ms
memory: 3812kb
input:
1000 0.686378 1 P P P N P N N N P N N P P N P P N N P P P P P N P P P N P P P P N N P N P P P P N N N P N P P P P P N P P P P P P P N N 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 N N P P N N N P P P P N P N P P P P P P N P N N P P P P N P N N P N P P P P P N P N P P P P P N P P N P P P P P N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #3:
score: 10
Accepted
time: 9ms
memory: 4008kb
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 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 N 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 N P P N 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 P P P P P P P P P P P P P P P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #4:
score: 10
Accepted
time: 0ms
memory: 3812kb
input:
1000 0.669578 1 P P P P P N P P P P P P N P N P P P N P P P P P P P P N P P P P P N N P N P P N P P N P P N P P P P N P N P P P P P P P P P P P P P P P N N P P N P P P N N P P N N P N P P N P N P P N N P P P P P P P P P P P P P N P P N P P P N P P P P P P N P P P P P N N N P P N P P N P P N N P P P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #5:
score: 10
Accepted
time: 7ms
memory: 3788kb
input:
1000 0.907052 1 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 N P P P P N 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 N 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 P P P P P P P P P P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #6:
score: 10
Accepted
time: 0ms
memory: 3776kb
input:
1000 0.844418 1 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 P P P 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 N P P P P P N P P P P P P P N P P P P P N P N P P N P P P P N P P N P P P P N N N P P P P P N N P N N P P P P P P P P N P N P P P P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #7:
score: 10
Accepted
time: 6ms
memory: 3840kb
input:
1000 0.533576 1 P P P P P P N N N N P P P N N P N P N P P P N P N N P N P P N P P N P N P N P P P P P N N N P P P P P P P N N P P P N P P P P P N P P P P P N N N N N P P N P P P N P N P P P P N P P P P P P N P N P P N N P P N N P N P P N N P P N P P N N P N P N P N N P P N N P N N P N P N N P P P N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #8:
score: 10
Accepted
time: 6ms
memory: 4016kb
input:
1000 0.415944 1 P P P N N N N N N N P P N N P N N P N P P N N N P N N N N P N N N N N P N N P N N P P P P N P P P N N P N N P N N P P P N P P P N N P P N P N N N N N P P N P N P N P N P N N P N N N N P P P N N P P P P P N P N N P P N N N P P N N P N P P P N P P P N P P P N P P N P P P P P N N P P N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #9:
score: 10
Accepted
time: 3ms
memory: 3988kb
input:
1000 0.596017 1 P P P P N P P N N P N P N P P P N P N N P P P P N P N P N P N N P N N P N N P P N P P P N P P P P N P P P N P N P P P P N P N N P P P P N P N N N P N P N N P P P N P P P P N N P N N P P P P N N P N P N N P P N N P N P P N N P P P P P N P P P P N N P P P P P P P N P P P N P P N P P P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #10:
score: 10
Accepted
time: 11ms
memory: 3792kb
input:
1000 0.157686 1 P P N P N N N N N P N N P N P P N N P N N P N N P N N N N N P N N N N N N P N P P N N P P N N P N P P N N N N N P N N N P N P N N N N N N P N P N P P N N N N N P N N P P N N N N P N N N N N P P P P P N N N N N N N P N P N N N P N N P N P N N N N P N N N P N N P N N N N N P N N P N N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #11:
score: 10
Accepted
time: 0ms
memory: 3776kb
input:
1000 0.380215 1 P P P N N N P N N N P P N N P N N N P P P N P N N N P P P P N P P N N N P N P N N P N N N P P P P P P N N N N N P P P N N N N N N N P N N N N N N N P P P N N N N P P N P N N P N N N N N P P P N P N N P N N P N N P N N N N P P P P P P P P N N N P P N N P N N N P P N P N P N P N P N N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #12:
score: 10
Accepted
time: 0ms
memory: 3840kb
input:
1000 0.432565 1 P P P P N P N N P N N P N P P P N P P N N P P P P N P P N N P P P P P N P P N P P N N N P P P P N P P N N P P P N N P N N P N P N P N P P N P P N N P N P N P N N N P N P P P N N N P N N P N P P N N N P N N P P P P P P P N P N P N N N N N N P P P N P N N N N P P P P P N P N N P P P P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #13:
score: 10
Accepted
time: 4ms
memory: 3812kb
input:
1000 0.509199 1 P P P P P N P N N N P P P N N N N N P N P N P P N P P N P P P P P P N N P N P P P N P P P P P P P P P P P P N P P P P N N P N P P N P P N P N N P N P P N P N N N N N P P P N N N P P P N P P N P P P P N N N P N P P N P N N N P P P P P P N N N P P P N P P N P N P P P P N N P P N P P N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #14:
score: 10
Accepted
time: 6ms
memory: 3816kb
input:
1000 0.381646 1 P P P N N N P N N N N P P P P N N N N N P P N N N P N P N P P N P N N N N N P N N P P N N N N P P P P N N N N N P P N N N N P N P N P N N N P P P N P P P N P P P N P N P P P P N N N N N P P P N N P P N P P P N P P N N N N P P P N N P N N N N P N P N N P P N N P N N N P P N P N P P N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #15:
score: 10
Accepted
time: 4ms
memory: 3760kb
input:
1000 0.42815 1 P P P N P P N P N P P P P N N P N N P N P N P P P N N N N P P P P N N N P P P N P N N P N N N P P P P N N N N P N P N P P N P N N N P N P N N N N N P P N P P N P P P P P N N N P P P N P P P P P N P P N P N P N N P N N P N N P P P N P P N N P P N N P P P P P P P P N N N P N P N P P P N...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #16:
score: 10
Accepted
time: 9ms
memory: 3792kb
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 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Test #17:
score: 10
Accepted
time: 1ms
memory: 3996kb
input:
1000 0 1 N N N N N C
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 translate:success
Subtask #2:
score: 23.77
Acceptable Answer
Test #18:
score: 35.48
Acceptable Answer
time: 27ms
memory: 3816kb
input:
1000 0.001 300 N N N N N C N N N P N N P N P N N N N P N N N N N N N N N C N N N N P P N N N N P P N N N N N N N P N N N P N N N N N N P N N P N N P N N N N P N N N N N N N C N N N N N C N N N N N C N P N N N P N N P N N N P N N N N N N N N N N C N N N P N N N N P N N P N N N N P N N N N N N C N N N...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 0.39422222220 0.3942222222 Output is correct (P=0.001, F=15.1, Q=20.9) -> 35.48 points
Test #19:
score: 25.12
Acceptable Answer
time: 99ms
memory: 3840kb
input:
1000 0.005256 300 P N N P N P N N N N N P N N P N N N N N N N P N N N N N P N P P N N N P N N N N N N N N N N N P N N N N P N N P N N N N N P N N N N P N N N P N N N N P N N N N P N N N N C N N N P P P N N N N N P N N N N N N N N N N P N P N P N N N N N N P N N N N P N N N P N N N N P N N N N N N C ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 0.27911111110 0.2791111111 Output is correct (P=0.005256, F=51.1, Q=84.1) -> 25.12 points
Test #20:
score: 23.77
Acceptable Answer
time: 193ms
memory: 3976kb
input:
1000 0.011546 300 P P N N P P N N N N N N N P N P N N N N N N N N N N N P P N N N N P N N N N N N N P N P N N P N N N N N N N P P N P N P N N N N N P N P N N N N N N N P P N N N N N N N P N N N N N P P N P N P N N N N N N N N N P N P N N N N N P N N N N N N P N N P N P N N N N N N N N P N P P N N N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 0.26411111110 0.2641111111 Output is correct (P=0.011546, F=94.9, Q=161.0) -> 23.77 points
Test #21:
score: 23.99
Acceptable Answer
time: 289ms
memory: 3972kb
input:
1000 0.028545 300 P P P P N N N N N N N N N N N P N N N N P N N N N N N N P N P N P N N N N N N N P P N N N P N N N N N N N P P N P N N P N N N P N N N N P P P N N N N N N N N N N N N P N N P P N N N N N N N N P N N N N N P N N P N P N N N N P N N N N P N P N N N N N N N P P P N N N N N N N P P P N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 0.26655555560 0.2665555556 Output is correct (P=0.028545, F=191.5, Q=323.2) -> 23.99 points
Test #22:
score: 24.62
Acceptable Answer
time: 473ms
memory: 3844kb
input:
1000 0.039856 300 P P N P N P N N N N N N N P N N N N N P N N P N P N N N N N N N N P N N N N P N N N N N P N N P N N P N N N N N N N P P N P N N N N N P P N N N N N N P N P P P N N N N N N P N P N N P N N N N N N N N P N P N N P N N N N N N P N N P N N N N N N P P N N N P N N N N N P N N N N P N N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 0.27355555560 0.2735555556 Output is correct (P=0.039856, F=246.3, Q=409.8) -> 24.62 points
Test #23:
score: 26.76
Acceptable Answer
time: 626ms
memory: 3804kb
input:
1000 0.068648 300 P P N P N N N N N N P N P N N P N N N P P N P N N N P P N P N P P N N N N N N N P P N N N N P N N N N N P N N N P N N N N P P N N N N P N N N P N N N N N P N N N N P N N N N N N N P P N N P N N N N N P N N N N N P P N P N N N P N N N N P N N N N P P P N N P N N N N P N N N P N N P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 0.29733333330 0.2973333333 Output is correct (P=0.068648, F=366.2, Q=582.6) -> 26.76 points
Test #24:
score: 29.7
Acceptable Answer
time: 682ms
memory: 3840kb
input:
1000 0.104571 300 P P N N P N N N N N P N N N P N N P N P P N N P N N P N N P N N P N N P N N N P N N P N P N N N N N P N N P P P P N N N N N N P P N P N N N N N N N N P P N N N N P N N N N P N N N N P N N N N P N N N N N P N N P N N N P N N P N P N N N P P N N P N N N P P P N P N N P N N N N N P N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 0.330 0.33 Output is correct (P=0.104571, F=490.3, Q=739.2) -> 29.70 points
Test #25:
score: 33.88
Acceptable Answer
time: 731ms
memory: 3808kb
input:
1000 0.158765 300 P P N N P P N N N N N P N N P P P N N N N N N P N N N P N N N N N P N P N P N P N P N N N N N N P N N N N N N N P N P N N N N N N N P P P N N N N N N N P N P N N P N N N N N N P N P N N P N N N P P N P N N N N N N P P N N N N N N N N N P N P P P N N N N P P P N N N N N P N N N N P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 0.37644444440 0.3764444444 Output is correct (P=0.158765, F=639.1, Q=903.8) -> 33.88 points
Test #26:
score: 37.31
Acceptable Answer
time: 899ms
memory: 3788kb
input:
1000 0.2 300 P P P N N N N P N N N P N P N P N N N N N P N N N N N P N P P P N N N N P N P P P N N P N P N N N P P N P N N N P P P N N N N N P N N P P N N N N N N N P N N N N N N N P P P P P N N N N N P P N N N N N P N N P N P N N N P N N N P N N N P N P P N P P N P N N N N N N P P P N P N N P N P N...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 0.41455555560 0.4145555556 Output is correct (P=0.2, F=731.4, Q=989.6) -> 37.31 points