답안 #863932

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
863932 2023-10-21T13:27:01 Z Unforgettablepl Mensza (COI22_mensza) C++17
11 / 100
3069 ms 151544 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
/*
ID: samikgo1
TASK: wormhole
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
//#define f first
//#define s second
//#define x first
//#define y second
const int INF = 1e9;
const ll modulo = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define int ll

void encode1(){
    int x;cin>>x;
    vector<int> ans;
    for(int i=1;i<=10;i++){
        if(x&(1<<(i-1)))for(int j=0;j<i;j++)ans.emplace_back(i);
    }
    cout << ans.size() << ' ';
    for(int&a:ans)cout<<a<<' ';
    cout << '\n';
}
void encode2(){
    int x;cin>>x;
    vector<int> ans;
    for(int i=1;i<=10;i++){
        if(x&(1<<(i-1)))for(int j=0;j<i+10;j++)ans.emplace_back(i+10);
    }
    cout << ans.size() << ' ';
    for(int&a:ans)cout<<a<<' ';
    cout << '\n';
}

void decode(){
    int a = 0;
    int b = 0;
    int l;cin>>l;
    vector<int> arr(l);
    for(int&i:arr)cin>>i;
    for(int&i:arr){
        if(i<=10){
            a|=(1<<(i-1));
        } else {
            b|=(1<<(i-11));
        }
    }
    if(a<b)cout<<"B\n";
    else cout<<"A\n";
}

void solve(){
    int l,Q;
    cin >> l >> Q;
    for (int i = 0; i < Q; i++) {
        string a;cin>>a;
        switch(a[0]){
            case 'a':
                encode1();
                break;
            case 'b':
                encode2();
                break;
            case 'c':
                decode();
                break;
        }
    }
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
//    int t;
//    cin >> t;
//    while(t--)
    solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 576 KB Integer parameter [name=l_510] equals to 116, violates the range [0, 110]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3069 ms 151544 KB Integer parameter [name=l_6] equals to 23, violates the range [0, 20]
2 Halted 0 ms 0 KB -