Submission #1328760

#TimeUsernameProblemLanguageResultExecution timeMemory
1328760Tyx2019Mensza (COI22_mensza)C++20
0 / 100
5100 ms589824 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;
    c = A;
    x = 1e9;
    V.clear();
    while(c != 0){
        if(c % 2 == 0) V.push_back(c+1);
        else V.push_back(x--);
        c/=2;
    }
    while(V.size() < 20) V.push_back(V[0]);
    cout << V.size() << " ";
    for(int x:V) cout << x << " ";
    cout << endl;
}
void Bob(){
    cin >> B;
    c = B;
    V.clear();
    while(c != 0){
        V.push_back(c);
        c/=2;
    }
    cout << V.size() << " ";
    for(int x:V) cout << x << " ";
    cout << endl;
}
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-2] >= 2){
        Asz = 21 - C[s-1];
        cout << (Asz <= Bsz ? "B" : "A") << endl;
    }
    else{
        Asz = 21 - C[s-1];
        cout << (Asz < Bsz ? "B" : "A") << endl;

    }
}
main(){
    int L, Q;
    cin >> L >> Q;
    while(Q--){
        string op;
        cin >> op;
        if(op == "alojzije"){
            Alice();
        }
        else if(op == "benjamin"){
            Bob();
        }
        else{
            Charlie();
        }
    }
}   

Compilation message (stderr)

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