Submission #1058458

# Submission time Handle Problem Language Result Execution time Memory
1058458 2024-08-14T10:04:51 Z rainboy COVID tests (CEOI24_covid) C
36.85 / 100
1474 ms 344 KB
#include <stdio.h>
#include <string.h>

#define N	1000

int n;

int query(int l, int r) {
	static char cc[N + 1], s[2];

	memset(cc, '0', n * sizeof *cc), memset(cc + l, '1', (r - l) * sizeof *cc), cc[n] = 0;
	printf("Q %s\n", cc), fflush(stdout);
	scanf("%s", s);
	return s[0] == 'P';
}

char cc[N + 1];

void solve(int l, int r) {
	int m;

	if (!query(l, r)) {
		memset(cc + l, '0', (r - l) * sizeof *cc);
		return;
	}
	if (r - l > 1) {
		m = (l + r) / 2;
		solve(l, m), solve(m, r);
	}
}

int main() {
	int t;

	scanf("%d%*f%d", &n, &t);
	while (t--) {
		memset(cc, '1', n * sizeof *cc), cc[n] = 0;
		solve(0, n);
		printf("A %s\n", cc), fflush(stdout);
		scanf("%*s");
	}
	return 0;
}

Compilation message

Main.c: In function 'query':
Main.c:13:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%s", s);
      |  ^~~~~~~~~~~~~~
Main.c: In function 'main':
Main.c:35:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |  scanf("%d%*f%d", &n, &t);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~
Main.c:40:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |   scanf("%*s");
      |   ^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 8 ms 344 KB Output is correct
3 Correct 9 ms 344 KB Output is correct
4 Correct 8 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 5 ms 344 KB Output is correct
8 Correct 6 ms 344 KB Output is correct
9 Correct 6 ms 344 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 4 ms 344 KB Output is correct
12 Correct 7 ms 344 KB Output is correct
13 Correct 7 ms 344 KB Output is correct
14 Correct 7 ms 344 KB Output is correct
15 Correct 10 ms 344 KB Output is correct
16 Correct 7 ms 340 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 344 KB Output is correct (P=0.001, F=15.1, Q=17.8) -> 52.47 points
2 Correct 120 ms 344 KB Output is correct (P=0.005256, F=51.1, Q=78.0) -> 28.98 points
3 Correct 222 ms 344 KB Output is correct (P=0.011546, F=94.9, Q=150.1) -> 27.05 points
4 Correct 484 ms 344 KB Output is correct (P=0.028545, F=191.5, Q=304.1) -> 26.85 points
5 Correct 582 ms 344 KB Output is correct (P=0.039856, F=246.3, Q=388.2) -> 27.24 points
6 Correct 909 ms 344 KB Output is correct (P=0.068648, F=366.2, Q=569.3) -> 27.96 points
7 Correct 1122 ms 344 KB Output is correct (P=0.104571, F=490.3, Q=751.8) -> 28.72 points
8 Correct 1359 ms 344 KB Output is correct (P=0.158765, F=639.1, Q=967.7) -> 29.44 points
9 Correct 1474 ms 344 KB Output is correct (P=0.2, F=731.4, Q=1112.6) -> 29.18 points