Submission #781883

#TimeUsernameProblemLanguageResultExecution timeMemory
781883rainboyMensza (COI22_mensza)C++17
100 / 100
2222 ms91224 KiB
/* https://codeforces.com/blog/entry/103280#comment-917355 (bmerry) */ #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:21:23: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   21 |      aa[n++] = a >> l + 1 | 1 << L - 1 - l;
      |                     ~~^~~
Main.cpp:21:40: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   21 |      aa[n++] = a >> l + 1 | 1 << L - 1 - l;
      |                                        ^
Main.cpp:31:23: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   31 |      aa[n++] = a >> l + 1 | 1 << L - 1 - l;
      |                     ~~^~~
Main.cpp:31:40: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   31 |      aa[n++] = a >> l + 1 | 1 << L - 1 - l;
      |                                        ^
Main.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%*d%d", &q);
      |  ~~~~~^~~~~~~~~~~~~
Main.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%s", s);
      |   ~~~~~^~~~~~~~~
Main.cpp:17:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |    scanf("%d", &a);
      |    ~~~~~^~~~~~~~~~
Main.cpp:27:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |    scanf("%d", &a);
      |    ~~~~~^~~~~~~~~~
Main.cpp:37:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |    scanf("%d", &n);
      |    ~~~~~^~~~~~~~~~
Main.cpp:40:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |     scanf("%d", &a);
      |     ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...