Submission #748889

# Submission time Handle Problem Language Result Execution time Memory
748889 2023-05-27T06:35:32 Z 반딧불(#9966) Mensza (COI22_mensza) C++17
34 / 100
5000 ms 148860 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<10; i++) if((x>>i)&1) for(int j=0; j<i*2+1; j++) v.push_back(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;
            for(int i=0; i<10; i++) if((x>>i)&1) for(int j=0; j<i*2+2; j++) v.push_back(i+100);
            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);
            int A=0, B=0;
            for(int i=0; i<len; i++){
                scanf("%d", &v[i]);
                if(v[i]%2) A += (1<<(v[i]/2));
                else       B += (1<<(v[i]/2-1));
            }
            printf("%c\n", A<B?'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:26:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |             scanf("%d", &x);
      |             ~~~~~^~~~~~~~~~
Main.cpp:33:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |             scanf("%d", &len);
      |             ~~~~~^~~~~~~~~~~~
Main.cpp:37:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |                 scanf("%d", &v[i]);
      |                 ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 9 ms 444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1079 ms 3208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5011 ms 148860 KB Time limit exceeded
2 Halted 0 ms 0 KB -