제출 #1329031

#제출 시각아이디문제언어결과실행 시간메모리
1329031nathjessMensza (COI22_mensza)C++20
0 / 100
2302 ms172288 KiB
# include <bits/stdc++.h>
# define int long long
# define vi vector<int>
# define pb push_back
# define pii pair<int, int>
# define fi first
# define se second
# define endl '\n'
# define jess ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

int l, q, a[1000004], b[1000005], c[5005];
string t[1000004];

void solve () {
    cin >> l >> q;
    for(int i=1; i<=q; i++) {
        cin >> t[i];
        if(t[i]=="alojzije") {
            cin >> a[i];
            int idx=1;
            vi v;
            for(int j=0; j<=9; j++) {
                if(((a[i]>>j)&1)==1) {
                    for(int ii=1; ii<=j*2+1; ii++) v.pb(idx);
                    idx+=2;
                }
            }
            cout << v.size() << " ";
            for(int j : v) cout << j << " ";
            cout << endl;
        }
        else if(t[i]=="benjamin") {
            cin >> b[i];
            int idx=2;
            vi v;
            for(int j=0; j<=9; j++) {
                if(((b[i]>>j)&1)==1) {
                    for(int ii=1; ii<=j*2+2; ii++) v.pb(idx);
                    idx+=2;
                }
            }
            cout << v.size();
            for(int j : v) cout << j << " ";
            cout << endl;
        } else {
            int len; cin >> len;
            int ben=0, alo=0; 
            for(int j=1; j<=len; j++) {
                cin >> c[i];
                if(c[i]%2==0) {
                    ben+=(1LL<<((c[i]-2)/2));
                } else {
                    alo+=(1LL<<((c[i]-1)/2));
                }
            }
            if(ben>alo) cout << "B" << endl;
            else cout << "A" << endl;
        }
    }

}
 
signed main() {
   jess;
   solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...