Submission #1114613

# Submission time Handle Problem Language Result Execution time Memory
1114613 2024-11-19T08:57:51 Z SalihSahin Mensza (COI22_mensza) C++17
34 / 100
5000 ms 136312 KB
#include <bits/stdc++.h>
#define pb push_back
#define int long long
using namespace std;
 
const int inf = 1e15 + 10;
const int N = 1e5 + 5;


int32_t main(){
   ios_base::sync_with_stdio(false);
   cin.tie(0); cout.tie(0);
   int L;
   cin>>L;

   int q;
   cin>>q;
   while(q--){
      string s;
      cin>>s;

      if(s[0] == 'a'){
         int a;
         cin>>a;
         vector<int> arra;
         for(int i = 0; i < 10; i++){
            if(a & (1 << i)){
               int x = 2*i + 1;
               while(x--){
                  arra.pb(2*i + 1);
               }
            }
         }
         cout<<arra.size()<<endl;
         for(auto itr: arra){
            cout<<itr<<" ";
         }
         cout<<endl;
      }
      else if(s[0] == 'b'){
         int b;
         cin>>b;
         vector<int> arrb;
         for(int i = 0; i < 10; i++){
            if(b & (1 << i)){
               int x = (i + 1) * 2;
               while(x--){
                  arrb.pb((i + 1) * 2);
               }
            }
         }
         cout<<arrb.size()<<endl;
         for(auto itr: arrb){
            cout<<itr<<" ";
         }
         cout<<endl;
      }
      else{
         int cl;
         cin>>cl;
         vector<int> c(cl);
         int aval = 0, bval = 0;
         for(int i = 0; i < cl; i++){
            cin>>c[i];
            if(c[i] & 1) aval += (1 << ((c[i] - 1) / 2));
            else bval += (1 << (c[i] / 2 - 1));
         }

         if(bval > aval) cout<<"B"<<endl;
         else cout<<"A"<<endl;
      }
   }

   return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 20 ms 840 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1944 ms 3288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5080 ms 136312 KB Time limit exceeded
2 Halted 0 ms 0 KB -