Submission #781188

#TimeUsernameProblemLanguageResultExecution timeMemory
781188rainboyMensza (COI22_mensza)C++17
34 / 100
5033 ms159492 KiB
#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", s); if (s[0] == 'a') { scanf("%d", &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') { scanf("%d", &a); 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 (stderr)

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", s);
      |   ~~~~~^~~~~~~~~
Main.cpp:18:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |    scanf("%d", &a);
      |    ~~~~~^~~~~~~~~~
Main.cpp:30:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |    scanf("%d", &a);
      |    ~~~~~^~~~~~~~~~
Main.cpp:42:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |    scanf("%d", &n);
      |    ~~~~~^~~~~~~~~~
Main.cpp:45:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |     scanf("%d", &x);
      |     ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...