Submission #1075067

# Submission time Handle Problem Language Result Execution time Memory
1075067 2024-08-25T18:02:13 Z pawned COVID tests (CEOI24_covid) C++17
52.27 / 100
1864 ms 596 KB
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;

const char nl = '\n';

void fastIO() {
	ios::sync_with_stdio(false);
	cin.tie(0);
}

int N, T;
double P;

char query(vi v) {
	string s(N, '0');
	for (int x : v)
		s[x] = '1';
	cout<<"Q "<<s<<endl;
	cout.flush();
	char c;
	cin>>c;
	return c;
}

char query(int l, int r) {
	string s(N, '0');
	for (int i = l; i <= r; i++) {
		s[i] = '1';
	}
	cout<<"Q "<<s<<endl;
	cout.flush();
	char c;
	cin>>c;
	return c;
}

string ans(N, '0');

void solve(int left, int right) {	// know there's positive on range
	if (left == right) {
		ans[left] = '1';
		return;
	}
	int mid = (left + right) / 2;
	if (query(left, mid) == 'P') {
		solve(left, mid);
		if (query(mid + 1, right) == 'P')
			solve(mid + 1, right);
	}
	else {	// surely has in right
		solve(mid + 1, right);
	}
}

int main() {
	fastIO();
	cin>>N>>P>>T;
	for (int i = 0; i < T; i++) {
		ans = string(N, '0');
		if (query(0, N - 1) == 'P')
			solve(0, N - 1);
//		cout<<"ANSWER: ";
		cout<<"A "<<ans<<endl;
		cout.flush();
		char c;
		cin>>c;
		if (c == 'W')
			break;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 344 KB Output is correct
2 Correct 11 ms 348 KB Output is correct
3 Correct 11 ms 348 KB Output is correct
4 Correct 11 ms 344 KB Output is correct
5 Correct 12 ms 344 KB Output is correct
6 Correct 14 ms 344 KB Output is correct
7 Correct 8 ms 344 KB Output is correct
8 Correct 9 ms 344 KB Output is correct
9 Correct 13 ms 344 KB Output is correct
10 Correct 4 ms 344 KB Output is correct
11 Correct 8 ms 372 KB Output is correct
12 Correct 10 ms 596 KB Output is correct
13 Correct 8 ms 344 KB Output is correct
14 Correct 8 ms 344 KB Output is correct
15 Correct 10 ms 344 KB Output is correct
16 Correct 14 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 344 KB Output is correct (P=0.001, F=15.1, Q=13.9) -> 90.00 points
2 Correct 102 ms 344 KB Output is correct (P=0.005256, F=51.1, Q=61.5) -> 49.61 points
3 Correct 194 ms 344 KB Output is correct (P=0.011546, F=94.9, Q=119.1) -> 44.55 points
4 Correct 373 ms 344 KB Output is correct (P=0.028545, F=191.5, Q=242.3) -> 43.67 points
5 Correct 512 ms 348 KB Output is correct (P=0.039856, F=246.3, Q=313.1) -> 43.17 points
6 Correct 773 ms 344 KB Output is correct (P=0.068648, F=366.2, Q=462.9) -> 43.77 points
7 Correct 1018 ms 344 KB Output is correct (P=0.104571, F=490.3, Q=619.0) -> 43.90 points
8 Correct 1431 ms 344 KB Output is correct (P=0.158765, F=639.1, Q=807.6) -> 43.80 points
9 Correct 1864 ms 344 KB Output is correct (P=0.2, F=731.4, Q=937.9) -> 42.27 points