Submission #781187

#TimeUsernameProblemLanguageResultExecution timeMemory
781187rainboyMensza (COI22_mensza)C++17
0 / 100
5058 ms163688 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%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 (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%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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...