Submission #1058448

# Submission time Handle Problem Language Result Execution time Memory
1058448 2024-08-14T10:02:38 Z rainboy COVID tests (CEOI24_covid) C
0 / 100
9 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, '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 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 344 KB translate:wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -