Submission #787246

# Submission time Handle Problem Language Result Execution time Memory
787246 2023-07-19T00:26:31 Z Username4132 Mensza (COI22_mensza) C++17
0 / 100
3 ms 444 KB
#include<iostream>
using namespace std;
#define forn(i, n) for(int i=0; i<(int)n; ++i)

char s[10];

inline int encode(int a, int b, int c, int d){
    return (a<<8) + (b<<2) + (c<<1) + d;
}

void solve(){
    scanf("%s", s);
    if(s[0]=='c'){
        int m, a; scanf("%d", &m);
        forn(i, m) scanf("%d", &a);
        printf("%c\n", a==1? 'B' : 'A');
        fflush(stdout);
    }
    else{
        int num; scanf("%d", &num);
        printf("19");
        forn(i, 19){
            int dig = !(num & (1<<i));
            printf(" %d", encode(num&((1<<24) - (1<<(i+1))), i, dig^(s[0]=='a'), dig|(s[0]=='a')));
        }
        printf("\n");
        fflush(stdout);
    }
}

int main(){
    int t; scanf(" %d", &t);
    while(t--) solve();
}

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%s", s);
      |     ~~~~~^~~~~~~~~
Main.cpp:14:24: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         int m, a; scanf("%d", &m);
      |                   ~~~~~^~~~~~~~~~
Main.cpp:15:25: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         forn(i, m) scanf("%d", &a);
      |                    ~~~~~^~~~~~~~~~
Main.cpp:20:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         int num; scanf("%d", &num);
      |                  ~~~~~^~~~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:32:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |     int t; scanf(" %d", &t);
      |            ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 444 KB Token "19" doesn't correspond to pattern "A|B"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -