Submission #747065

# Submission time Handle Problem Language Result Execution time Memory
747065 2023-05-23T14:49:46 Z model_code Mensza (COI22_mensza) C++17
100 / 100
2695 ms 137712 KB
#include <bits/stdc++.h>

using namespace std;

int l, q;

void alojzije() {
  int a;
  scanf("%d", &a);

  vector<int> ret;
  int curr = 0;
  for (int i = 18; i >= 0; --i) {
    if (a & (1 << i)) {
      curr |= 1 << i;
      ret.emplace_back(curr);
    }
  }

  printf("%d", (int)ret.size());
  for (int x : ret) printf(" %d", x);
  printf("\n");
}

void benjamin() {
  int b;
  scanf("%d", &b);

  vector<int> ret;
  int curr = 0;
  for (int i = 18; i >= 0; --i) {
    if (b & (1 << i))
      curr |= 1 << i;
    else
      ret.emplace_back(curr | (1 << i));
  }

  printf("%d", (int)ret.size());
  for (int x : ret) printf(" %d", x);
  printf("\n");
}

void cecilija() {
  int l, x;
  scanf("%d", &l);
  for (int i = 0; i < l; ++i)
    scanf("%d", &x);
  if (x != 1)
    printf("A\n");
  else
    printf("B\n");
}

int main(void) {
  scanf("%d%d", &l, &q);
  while (q--) {
    char t[10];
    scanf("%s", t);
    if (t[0] == 'a') alojzije();
    if (t[0] == 'b') benjamin();
    if (t[0] == 'c') cecilija();
  }
  return 0;
}

Compilation message

Main.cpp: In function 'void alojzije()':
Main.cpp:9:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |   scanf("%d", &a);
      |   ~~~~~^~~~~~~~~~
Main.cpp: In function 'void benjamin()':
Main.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |   scanf("%d", &b);
      |   ~~~~~^~~~~~~~~~
Main.cpp: In function 'void cecilija()':
Main.cpp:45:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |   scanf("%d", &l);
      |   ~~~~~^~~~~~~~~~
Main.cpp:47:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |     scanf("%d", &x);
      |     ~~~~~^~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:55:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |   scanf("%d%d", &l, &q);
      |   ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:58:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   58 |     scanf("%s", t);
      |     ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 15 ms 436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1305 ms 2744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2695 ms 137712 KB Output is correct