답안 #1060734

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1060734 2024-08-15T21:27:04 Z Dan4Life COVID tests (CEOI24_covid) C++17
0 / 100
7000 ms 344 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a), end(a)
using ll = long long;
using vi = vector<int>;
using ar2 = array<int,2>;
using ar3 = array<int,3>;
using ar4 = array<int,4>;
const int INF = (int)2e9;
const int mxN = (int)1e3+10;

int N;
double P;
bitset<mxN> answer, test;

bool test_students() {
	cout << "Q ";
	for(int i = 0; i < N; i++) cout << test[i];
	cout << endl; char c; cin >> c; return (c=='P');
}

/// You should implement:

// This function will be called once for each test instance.
// It should use test_students to determine which samples are positive.
// It must return a vector of Booleans of length N,
// where the i-th element is true if and only if the i-th sample is positive.
bitset<mxN> find_positive() {
	answer.reset(), test.reset();
	int l = 0;
	while(l<N){
		test>>=l; test.set(); test<<=l;
		if(!test_students()) return answer;
		test.reset();
		int r = N-1, oldL = l;
		while(l<r){
			int mid = (l+r)/2;
			for(int i = oldL; i<=mid; i++) test[i]=1;
			if(test_students()) r=mid;
			else l=mid+1;
			for(int i = oldL; i<=mid; i++) test[i]=0;
		}
		answer[l]=1; l++;
	}
    return answer;
}

int main() {
    int T; cin >> N >> P >> T;

    // You may perform any extra initialization here.

    for (int i = 0; i < T; i++) {
		find_positive();
		cout << "A ";
		for(int i = 0; i < N; i++) cout << answer[i];
		cout << endl;
        char verdict; cin >> verdict;
        if (verdict == 'W') exit(0);
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 343 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 148 ms 344 KB Output is correct (P=0.001, F=15.1, Q=10.7) -> 90.00 points
2 Correct 709 ms 344 KB Output is correct (P=0.005256, F=51.1, Q=52.9) -> 78.89 points
3 Correct 1476 ms 344 KB Output is correct (P=0.011546, F=94.9, Q=114.6) -> 49.17 points
4 Correct 3315 ms 344 KB Output is correct (P=0.028545, F=191.5, Q=279.4) -> 31.73 points
5 Correct 4626 ms 344 KB Output is correct (P=0.039856, F=246.3, Q=392.4) -> 26.68 points
6 Execution timed out 7014 ms 344 KB Time limit exceeded
7 Halted 0 ms 0 KB -