Submission #1328801

#TimeUsernameProblemLanguageResultExecution timeMemory
1328801Tyx2019Mensza (COI22_mensza)C++20
0 / 100
5092 ms76508 KiB
#include <bits/stdc++.h>
#define dbg(x) if(dd) cout << #x << " is " << x << endl;
#define debug(x) if(dd) cout << #x << " is " << x << endl;
#define int long long
bool dd = 1;
using namespace std;
vector<int> V;
vector<int> C;
int s,A,sm,Bsz,Asz,x,B,c;
void Alice(){
    cin >> A;
    A += 1048576;
    c = A;
    x = 1e9;
    V.clear();
    while(c > 1){
        if(c % 2 == 0) V.push_back(c+1);
        c/=2;
    }
    cout << V.size() << " ";
    for(int x:V) cout << x << " ";
    cout << '\n';
}
void Bob(){
    cin >> B;
    B += 1048576;
    c = B;
    V.clear();
    while(c > 1){
        V.push_back(c);
        c/=2;
    }
    cout << V.size() << " ";
    for(int x:V) cout << x << " ";
    cout << '\n';
}
void Charlie(){
    cin >> s;
    C.clear();
    for(int i=0;i<s;i++){
        int x;
        cin >> x;
        C.push_back(x);
    }
    sm = accumulate(C.begin(), C.end(), 0);
    Bsz = sm - 20;
    if(C[s-1] >= 2){
        cout << "B" << '\n';
    }
    else cout << "A" << '\n';
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int L, Q;
    cin >> L >> Q;
    string op;
    while(Q--){
        cin >> op;
        if(op == "alojzije"){
            Alice();
        }
        else if(op == "benjamin"){
            Bob();
        }
        else{
            Charlie();
        }
    }
}   

Compilation message (stderr)

Main.cpp:52:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   52 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...