Submission #781187

# Submission time Handle Problem Language Result Execution time Memory
781187 2023-07-12T22:01:58 Z rainboy Mensza (COI22_mensza) C++17
0 / 100
5000 ms 163688 KB
#include <stdio.h>
#include <string.h>

#define L	10
#define N	110

int main() {
	int q;

	scanf("%*d%d", &q);
	while (q--) {
		static char s[9];
		static int aa[N], mask[N];
		int n, l, a, x, k;

		scanf("%s%d", s, &a);
		if (s[0] == 'a') {
			n = 0;
			for (l = 0; l < L; l++) {
				k = (a & 1 << l) == 0 ? l * 2 + 0 : l * 2 + 1;
				while (k--)
					aa[n++] = l;
			}
			printf("%d", n);
			while (n--)
				printf(" %d", aa[n]);
			printf("\n");
		} else if (s[0] == 'b') {
			n = 0;
			for (l = 0; l < L; l++) {
				k = (a & 1 << l) == 0 ? l * 2 + 0 : l * 2 + 2;
				while (k--)
					aa[n++] = l;
			}
			printf("%d", n);
			while (n--)
				printf(" %d", aa[n]);
			printf("\n");
		} else {
			scanf("%d", &n);
			memset(mask, 0, L * sizeof *mask);
			while (n--) {
				scanf("%d", &x);
				mask[x / 4] = x % 4;
			}
			for (l = L - 1; l >= 0; l--)
				if (mask[l] != 0 && mask[l] != 3) {
					printf(mask[l] == 1 ? "A\n" : "B\n");
					break;
				}
		}
	}
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%*d%d", &q);
      |  ~~~~~^~~~~~~~~~~~~
Main.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |   scanf("%s%d", s, &a);
      |   ~~~~~^~~~~~~~~~~~~~~
Main.cpp:40:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |    scanf("%d", &n);
      |    ~~~~~^~~~~~~~~~
Main.cpp:43:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |     scanf("%d", &x);
      |     ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 5048 ms 464 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5038 ms 1208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5058 ms 163688 KB Time limit exceeded
2 Halted 0 ms 0 KB -