Submission #864691

#TimeUsernameProblemLanguageResultExecution timeMemory
864691Trisanu_DasMensza (COI22_mensza)C++17
100 / 100
2183 ms91476 KiB
#include <stdio.h> #define L 19 int main() { int q; scanf("%*d%d", &q); while (q--) { static char s[9]; static int aa[L]; int n, l, a, gt; scanf("%s", s); if (s[0] == 'a') { scanf("%d", &a); n = 0; for (l = 0; l < L; l++) if ((a & 1 << l) != 0) aa[n++] = a >> l + 1 | 1 << L - 1 - 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++) if ((a & 1 << l) == 0) aa[n++] = a >> l + 1 | 1 << L - 1 - l; printf("%d", n); while (n--) printf(" %d", aa[n]); printf("\n"); } else { scanf("%d", &n); gt = 0; while (n--) { scanf("%d", &a); if (a == 2) gt = 1; } printf(gt ? "A\n" : "B\n"); } } return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:17:68: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   17 |    for (l = 0; l < L; l++) if ((a & 1 << l) != 0) aa[n++] = a >> l + 1 | 1 << L - 1 - l;
      |                                                                  ~~^~~
Main.cpp:17:85: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   17 |    for (l = 0; l < L; l++) if ((a & 1 << l) != 0) aa[n++] = a >> l + 1 | 1 << L - 1 - l;
      |                                                                                     ^
Main.cpp:24:68: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   24 |    for (l = 0; l < L; l++) if ((a & 1 << l) == 0) aa[n++] = a >> l + 1 | 1 << L - 1 - l;
      |                                                                  ~~^~~
Main.cpp:24:85: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   24 |    for (l = 0; l < L; l++) if ((a & 1 << l) == 0) aa[n++] = a >> l + 1 | 1 << L - 1 - l;
      |                                                                                     ^
Main.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  scanf("%*d%d", &q);
      |  ~~~~~^~~~~~~~~~~~~
Main.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%s", s);
      |   ~~~~~^~~~~~~~~
Main.cpp:15:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |    scanf("%d", &a);
      |    ~~~~~^~~~~~~~~~
Main.cpp:22:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |    scanf("%d", &a);
      |    ~~~~~^~~~~~~~~~
Main.cpp:29:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |    scanf("%d", &n);
      |    ~~~~~^~~~~~~~~~
Main.cpp:32:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |     scanf("%d", &a);
      |     ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...