답안 #850616

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
850616 2023-09-17T07:23:25 Z Cyanmond Mensza (COI22_mensza) C++17
34 / 100
2346 ms 126544 KB
#include <bits/stdc++.h>

using namespace std;

#define rep(i, l, r) for (int i = (l); i < (r); ++i)
#define per(i, l, r) for (int i = (r - 1); i >= l; --i)
#define ALL(x) (x).begin(), (x).end()

using i64 = long long;

void main_() {
    int L, Q;
    scanf("%d%d", &L, &Q);
    while (Q--) {
        char name[10];
        scanf("%s", &name);
        if (name[0] == 'a') {
            int N;
            scanf("%d", &N);
            vector<int> ret;
            int v = 0;
            per(i, 0, 18) {
                if (N & (1 << i)) {
                    v |= 1 << i;
                    ret.push_back(v);
                }
            }

            printf("%d", ret.size());
            for (const auto e : ret) printf(" %d", e);
            printf("\n");
        }
        if (name[0] == 'b') {
            int N;
            scanf("%d", &N);
            vector<int> ret;
            int v = 0;
            per(i, 0, 18) {
                if (N & (1 << i)) {
                    v |= 1 << i;
                } else {
                    ret.push_back(v | (1 << i));
                }
            }

            printf("%d", ret.size());
            for (const auto e : ret) printf(" %d", e);
            printf("\n");
        }
        if (name[0] == 'c') {
            int N;
            scanf("%d", &N);
            vector<int> c(N);
            for (auto &e : c) scanf("%d", &e);

            bool ans = c.back() == 1;
            if (ans) printf("B\n");
            else printf("A\n");
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    main_();
}

Compilation message

Main.cpp: In function 'void main_()':
Main.cpp:16:17: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[10]' [-Wformat=]
   16 |         scanf("%s", &name);
      |                ~^   ~~~~~
      |                 |   |
      |                 |   char (*)[10]
      |                 char*
Main.cpp:29:22: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   29 |             printf("%d", ret.size());
      |                     ~^   ~~~~~~~~~~
      |                      |           |
      |                      int         std::vector<int>::size_type {aka long unsigned int}
      |                     %ld
Main.cpp:46:22: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   46 |             printf("%d", ret.size());
      |                     ~^   ~~~~~~~~~~
      |                      |           |
      |                      int         std::vector<int>::size_type {aka long unsigned int}
      |                     %ld
Main.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d%d", &L, &Q);
      |     ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%s", &name);
      |         ~~~~~^~~~~~~~~~~~~
Main.cpp:19:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |             scanf("%d", &N);
      |             ~~~~~^~~~~~~~~~
Main.cpp:35:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |             scanf("%d", &N);
      |             ~~~~~^~~~~~~~~~
Main.cpp:52:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |             scanf("%d", &N);
      |             ~~~~~^~~~~~~~~~
Main.cpp:54:36: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |             for (auto &e : c) scanf("%d", &e);
      |                               ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1172 ms 2820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2346 ms 126544 KB Wrong answer on query 9902: expected A, found B
2 Halted 0 ms 0 KB -