Submission #1252121

#TimeUsernameProblemLanguageResultExecution timeMemory
1252121al95ireyizTable Tennis (info1cup20_tabletennis)C++20
0 / 100
3094 ms1092 KiB
//*** Bismillah ***//
#pragma GCC optimize("O3", "fast-math", "unroll-loops", "no-stack-protector")
#include <bits/stdc++.h>
using namespace std;
#if !defined(ONLINE_JUDGE) and !defined(EVAL)
#include "template/debug.h"
#else
#define d(x...)
#endif
#define fr first
#define er erase
#define sc second
#define in insert
#define ll long long
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define ull unsigned ll
#define vpll vector<pll>
#define len(x) (ll) x.size()
#define all(x) x.begin(),x.end()
const ll INF = 1e9;
const ll INFL = 1e18;
const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll maxn = 1e5+5;
ll n,m,k=0;
ll a[maxn];
void _(ll &tt){
    cin >> n >> m;
    for(ll i = 1; i <= n + m; i ++){
        cin >> a[i];
    }
    for(ll i = 0; i < (1LL << (n + m)); i ++){
        if(__builtin_popcountll(i) != m) continue;
        vll v;
        for(ll j = 0; j < n + m; j ++){
            if(i & (1LL << j)) continue;
            v.pb(j + 1);
        }
        sort(all(v), [&](auto x, auto y) { return a[x] < a[y]; });
        ll f = 1;
        for(ll j = 0; j < len(v); j ++){
            if(a[v[j]] + a[v[len(v) - j - 1]] != a[v[0]] + a[v.back()]){
                f = 0;
                break;
            }
        }
        if(f){
            for(auto x : v) cout << x << ' ';
            return;
        }
    }
}
signed main() {
    ll tm = clock();
    cin.tie(0)->sync_with_stdio(0);
    ll t = 1;
    // cin >> t;
    for(ll tt = 1; tt <= t; tt ++) {
        _(tt);
    }
    cerr << "\n\033[1;31mTime: \033[1;30m" \
         << (double)(clock()-tm)/1000000 << "\033[1;32m seconds\n";
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...