Submission #1132653

#TimeUsernameProblemLanguageResultExecution timeMemory
1132653marchell_hiiTable Tennis (info1cup20_tabletennis)C++20
87 / 100
3095 ms4324 KiB
// ███╗   ███╗ █████╗ ██████╗ ███████╗    ██████╗ ██╗   ██╗       ███╗   ███╗ █████╗ ██████╗  ██████╗██╗  ██╗███████╗██╗     ██╗           ██╗  ██╗██╗██╗
// ████╗ ████║██╔══██╗██╔══██╗██╔════╝    ██╔══██╗╚██╗ ██╔╝██╗    ████╗ ████║██╔══██╗██╔══██╗██╔════╝██║  ██║██╔════╝██║     ██║           ██║  ██║██║██║
// ██╔████╔██║███████║██║  ██║█████╗      ██████╔╝ ╚████╔╝ ╚═╝    ██╔████╔██║███████║██████╔╝██║     ███████║█████╗  ██║     ██║           ███████║██║██║
// ██║╚██╔╝██║██╔══██║██║  ██║██╔══╝      ██╔══██╗  ╚██╔╝  ██╗    ██║╚██╔╝██║██╔══██║██╔══██╗██║     ██╔══██║██╔══╝  ██║     ██║           ██╔══██║██║██║
// ██║ ╚═╝ ██║██║  ██║██████╔╝███████╗    ██████╔╝   ██║   ╚═╝    ██║ ╚═╝ ██║██║  ██║██║  ██║╚██████╗██║  ██║███████╗███████╗███████╗█████╗██║  ██║██║██║
// ╚═╝     ╚═╝╚═╝  ╚═╝╚═════╝ ╚══════╝    ╚═════╝    ╚═╝          ╚═╝     ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝╚══════╝╚══════╝╚══════╝╚════╝╚═╝  ╚═╝╚═╝╚═╝
// ඞ
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣤⣤⣤⣤⣤⣤⣤⣤⣄⡀
// ⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⡿⠛⠉⠉⠉⠉⠉⠉⠻⢿⣿⣷⡄
// ⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⠋⠀⠀⠀⠀⠀⠀⠀      ⢻⣿⣿⡄
// ⠀⠀⠀⠀⠀⠀⠀⣸⣿⡏⠀⠀⠀   ⣠⣾⣿⣿⣿⠿⠿⠿⢿⣿⣿⣄
// ⠀⠀⠀⠀⠀⠀⠀⣿⣿⠁⠀⠀    ⣿⣿⣯⠁⠀⠀⠀⠀⠀  ⠙⢿⣷⡄
// ⠀⠀⣀⣤⣴⣶⣶⣿⡟⠀⠀⠀   ⣿⣿⣿            ⣿⣷
// ⠀⢰⣿⡟⠋⠉⣹⣿⡇⠀⠀⠀   ⣿⣿⣿⣷⣦⣀⣀⣀⣀⣀⣀⣀⣿⣿
//  ⢸⣿⡇   ⣿⣿⡇⠀⠀     ⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
//  ⣸⣿⡇   ⣿⣿⡇⠀⠀⠀⠀    ⠉⠉⠉⠉⠉⠉⠉⠉⠉⡿⢻⡇
// ⠀⣿⣿    ⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀       ⢸⣿⡇
// ⠀⣿⣿⠀   ⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀      ⢸⣿⡇
// ⠀⣿⣿⠀⠀  ⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀      ⢸⣿⡇
// ⠀⢿⣿   ⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀         ⣿⡇
// ⠀⠸⣿⣦⡀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀       ⣿⣿
// ⠀⠀⠛⢿⣿⣿⣿⣿⡇    ⠀⣠⣿⣿⣿⣿⣄       ⣿⣿
// ⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⣿⣿⡇⠀⣽⣿⡆     ⢸⣿⡇
// ⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⣿⣿⡇⠀⢹⣿⡆⠀⠀   ⣸⣿⠇
// ⠀⠀⠀⠀⠀⠀⠀⢿⣿⣦⣄⣀⣠⣴⣿⣿ ⠀⠈⠻⣿⣿⣿⣿⡿⠏
// ⠀⠀⠀⠀⠀⠀⠀⠈⠛⠻⠿⠿⠿⠿⠋⠁
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define plll pair<pll, pll>
#define pdd pair<double, double>
#define pu push_back
#define po pop_back
#define fi first
#define se second
#define fifi fi.fi
#define fise fi.se
#define sefi se.fi
#define sese se.se
#define cekcek cout<<'c'<<'e'<<'k'<<endl
using namespace std;

ll N, K, A[200005], L, R, sum, tot;
vector<ll> v;
bool udh, vis[200005];

int main(){
ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
cin >> N >> K;
for(ll i = 1; i <= N + K; i++) cin >> A[i];
for(ll i = 1; i <= K + 1; i++){
    for(ll j = N + K; j >= N + i - 1; j--){
        L = i;
        R = j;
        sum = A[L] + A[R];
        v.clear();
        tot = 0;
        while(L < R){
            if(A[L] + A[R] == sum){
                tot++;
                L++;
                R--;
            }
            else{
                if(A[L] + A[R] > sum){
                    v.pu(R);
                    R--;
                }
                else{
                    v.pu(L);
                    L++;
                }
                continue;
            }
            if(tot * 2 == N){
                for(ll k = 1; k <= N + K; k++){
                    if(k < i || (L <= k && k <= R) || j < k) v.pu(k);
                }
                udh = true;
                break;
            }
        }
        if(udh) break;
    }
    if(udh) break;
}
for(auto i : v) vis[i] = true;
for(ll i = 1; i <= N + K; i++){
    if(!vis[i]) cout << A[i] << " ";
}
cout << endl;
}
#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...