제출 #1328759

#제출 시각아이디문제언어결과실행 시간메모리
1328759Tyx2019Mensza (COI22_mensza)C++20
0 / 100
5079 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;
void print(vector<int> V){
    cout << V.size() << " ";
    for(int x:V) cout << x << " ";
    cout << endl;
}
void Alice(){
    int A;
    cin >> A;
    vector<int> V;
    int c = A;
    int x = 1e9;
    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]);
    print(V);
}
void Bob(){
    int B;
    cin >> B;
    vector<int> V;
    int c = B;
    while(c != 0){
        V.push_back(c);
        c/=2;
    }
    print(V);
}
void Charlie(){
    vector<int> C;
    int s;
    cin >> s;
    for(int i=0;i<s;i++){
        int x;
        cin >> x;
        C.push_back(x);
    }
    int sm = accumulate(C.begin(), C.end(), 0);
    int Bsz = sm - 20;
    if(C[s-2] >= 2){
        int Asz = 21 - C[s-1];
        cout << (Asz <= Bsz ? "B" : "A") << endl;
    }
    else{
        int 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();
        }
    }
}   

컴파일 시 표준 에러 (stderr) 메시지

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