답안 #1094610

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1094610 2024-09-30T06:35:24 Z epicci23 COVID tests (CEOI24_covid) C++17
10 / 100
7000 ms 348 KB
#include "bits/stdc++.h"
//#define int long long
#define double long double
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;
 
mt19937 rng(time(nullptr));
 
int BL,n,tc=1;
double p;
vector<bool> cur,A;
vector<int> ar,Store;
 
double fast_pow(double x,int b){
 if(b==0) return 1.0;
 double res = fast_pow(x,b/2);
 res*=res;
 if(b&1) res*=x;
 return res;
}
 
void update_block(){
  int l=1,r=n;
  while(l<r){
    int mid=(l+r+1)/2;
    if(fast_pow(p,mid)>=0.5L) l=mid;
    else r=mid-1;
  }
  Store.resize(n+5);
  for(int i=1;i<=n;i++) Store[i]=min(i,l);
}
 
bool test_students(vector<bool> mask){
  cout << "Q ";
  for(int x:mask) cout << x;
  cout << '\n' << flush; 
  char answer; cin >> answer;
  return answer == 'P';
}
 
bool ask_range(int l,int r){
  for(int i=l;i<=r;i++) cur[ar[i]]=1;
  bool XD = test_students(cur);
  for(int i=l;i<=r;i++) cur[ar[i]]=0;
  return XD;
}
 
int find_first(int l,int r){
  if(l==r) return l;
  int m=(l+r)/2;
  if(ask_range(l,m)) return find_first(l,m);
  return find_first(m+1,r);
}
 
vector<bool> find_positive(){
  A.assign(n,0);
  for(int i=0;i<n;){
    BL=Store[n-i];
    if(!ask_range(i,min(n-1,i+BL-1))){
      i+=BL;
      continue;
    }
    int lmao = find_first(i,min(n-1,i+BL-1));
    A[ar[lmao]]=1;
    i=lmao+1;
  }
  return A;
}
 
void _(){
  vector<bool> GG=find_positive();
  cout << "A ";
  for(bool x:GG) cout << x;
  cout << '\n' << flush;
  char son; cin >> son;
  if(son=='C') return;
  else exit(0);
}
 
int32_t main(){
  cin.tie(0); ios::sync_with_stdio(0);
  cin >> n >> p >> tc;
  p=1.0-p;
  update_block();
  ar.assign(n,0);
  cur.assign(n,0);
  iota(all(ar),0LL);
  shuffle(all(ar),rng);
  while(tc--) _();
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 344 KB Output is correct
2 Correct 31 ms 344 KB Output is correct
3 Correct 31 ms 344 KB Output is correct
4 Correct 31 ms 344 KB Output is correct
5 Correct 31 ms 344 KB Output is correct
6 Correct 46 ms 344 KB Output is correct
7 Correct 43 ms 344 KB Output is correct
8 Correct 31 ms 344 KB Output is correct
9 Correct 37 ms 340 KB Output is correct
10 Correct 21 ms 344 KB Output is correct
11 Correct 38 ms 344 KB Output is correct
12 Correct 31 ms 344 KB Output is correct
13 Correct 31 ms 348 KB Output is correct
14 Correct 41 ms 344 KB Output is correct
15 Correct 35 ms 344 KB Output is correct
16 Correct 32 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 163 ms 344 KB Output is correct (P=0.001, F=15.1, Q=10.9) -> 90.00 points
2 Correct 482 ms 344 KB Output is correct (P=0.005256, F=51.1, Q=46.7) -> 90.00 points
3 Correct 913 ms 344 KB Output is correct (P=0.011546, F=94.9, Q=91.3) -> 90.00 points
4 Correct 2033 ms 344 KB Output is correct (P=0.028545, F=191.5, Q=190.4) -> 90.00 points
5 Correct 2603 ms 344 KB Output is correct (P=0.039856, F=246.3, Q=246.8) -> 89.28 points
6 Correct 4011 ms 344 KB Output is correct (P=0.068648, F=366.2, Q=372.0) -> 84.64 points
7 Correct 5469 ms 344 KB Output is correct (P=0.104571, F=490.3, Q=499.5) -> 83.72 points
8 Correct 6611 ms 344 KB Output is correct (P=0.158765, F=639.1, Q=633.0) -> 90.00 points
9 Execution timed out 7060 ms 344 KB Time limit exceeded
10 Halted 0 ms 0 KB -