답안 #748933

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
748933 2023-05-27T07:17:48 Z 반딧불(#9966) Mensza (COI22_mensza) C++17
100 / 100
3947 ms 139448 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int L, st;
int q;
char str[15];

int main(){
    scanf("%d", &L);
    st = (L==200 ? 1 : L==110 ? 2 : 3);
    scanf("%d", &q);
    while(q--){
        scanf("%s", str);
        if(str[0] == 'a'){
            int x;
            scanf("%d", &x);
            vector<int> v;
            for(int i=0; i<19; i++){
                if((x>>i)&1) continue;
                v.push_back((x+(1<<i)) >> i << i);
            }
            printf("%d ", (int)v.size()); for(auto x: v) printf("%d ", x); puts(""); fflush(stdout);
        }
        else if(str[0] == 'b'){
            int x;
            scanf("%d", &x);
            vector<int> v;
            int T = 0;
            for(int i=18; i>=0; i--) if((x>>i)&1) T+=(1<<i), v.push_back(T);
            printf("%d ", (int)v.size()); for(auto x: v) printf("%d ", x); puts(""); fflush(stdout);
        }
        else{
            int len;
            scanf("%d", &len);
            vector<int> v(len);
            for(int i=0; i<len; i++){
                scanf("%d", &v[i]);
            }
            printf("%c\n", *max_element(v.begin(), v.end()) == 2 ?'B':'A');
        }
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d", &L);
      |     ~~~~~^~~~~~~~~~
Main.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%d", &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", str);
      |         ~~~~~^~~~~~~~~~~
Main.cpp:19:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |             scanf("%d", &x);
      |             ~~~~~^~~~~~~~~~
Main.cpp:29:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |             scanf("%d", &x);
      |             ~~~~~^~~~~~~~~~
Main.cpp:37:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |             scanf("%d", &len);
      |             ~~~~~^~~~~~~~~~~~
Main.cpp:40:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |                 scanf("%d", &v[i]);
      |                 ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 544 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1628 ms 2800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3947 ms 139448 KB Output is correct