답안 #1044159

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1044159 2024-08-05T07:41:36 Z alex_2008 COVID tests (CEOI24_covid) C++14
10 / 100
5644 ms 344 KB
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
typedef long long ll;
using namespace std;
const int N = 2e5 + 10;
int n, t;
long double p;
bool ch(int l, int r) {
	string s = string(n, '0');
	for (int i = l - 1; i < r; i++) {
		s[i] = '1';
	}
	cout << "Q " << s << endl;
	char x;
	cin >> x;
	if (x == 'P') return true;
	return false;
}
int main() {
	cin >> n >> p >> t;
	if (t == 1) {
		string ans = string(n, '0');
		for (int i = 1; i <= n; i++) {
			cout << "Q ";
			string s = string(n, '0');
			s[i - 1] = '1';
			cout << s << endl;
			char x;
			cin >> x;
			if (x == 'P') ans[i - 1] = '1';
		}
		cout << "A " << ans << endl;
		char x;
		cin >> x;
		return 0;
	}
	if (p <= 0.01) {
		while (t--) {
			string answ = string(n, '0');
			int last = 0;
			while (1) {
				if (!ch(last + 1, n)) {
					break;
				}
				int l = last + 1, r = n - 1, ans = last;
				while (l <= r) {
					int mid = (l + r) / 2;
					if (!ch(last + 1, mid)) {
						ans = mid;
						l = mid + 1;
					}
					else r = mid - 1;
				}
				answ[ans] = '1';
				last = ans + 1;
			}
			cout << "A " << answ << endl;
			char x;
			cin >> x;
		}
		return 0;
	}
	else {
		while (t--) {
			string answ = string(n, '0');
			int last = 0;
			while (1) {
				int l = last + 1, r = n, ans = -1;
				while (l <= r) {
					int mid = (l + r) / 2;
					if (!ch(last + 1, mid)) {
						ans = mid;
						l = mid + 1;
					}
					else r = mid - 1;
				}
				if (ans == n) break;
				answ[ans] = '1';
				last = ans + 1;
			}
			cout << "A " << answ << endl;
			char x;
			cin >> x;
		}
		return 0;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5644 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 6 ms 344 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
10 Correct 4 ms 344 KB Output is correct
11 Correct 4 ms 344 KB Output is correct
12 Correct 4 ms 344 KB Output is correct
13 Correct 4 ms 344 KB Output is correct
14 Correct 4 ms 344 KB Output is correct
15 Correct 2 ms 344 KB Output is correct
16 Correct 8 ms 344 KB Output is correct
17 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 344 KB Output is correct (P=0.001, F=15.1, Q=10.7) -> 90.00 points
2 Correct 84 ms 344 KB Output is correct (P=0.005256, F=51.1, Q=52.9) -> 78.89 points
3 Execution timed out 3782 ms 344 KB Time limit exceeded (wall clock)
4 Halted 0 ms 0 KB -