제출 #1252561

#제출 시각아이디문제언어결과실행 시간메모리
1252561al95ireyizTable Tennis (info1cup20_tabletennis)C++20
20 / 100
3096 ms10056 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 = 2e5+5; ll n,m,k=0; ll a[maxn]; vll v; ll f(ll i = 1, ll q = m){ if(q < 0) return 0; if(i == n + m + 1){ d(i, q, v); if(q != 0) return 0; ll l = 1, r = n + m, _l = 0, _r = m - 1, bf = -1; while(l < r){ if(_l < m and l == v[_l]){ _l ++, l ++; continue; } if(_r >= 0 and r == v[_r]){ _r --, r --; continue; } if(bf == -1){ bf = a[l] + a[r]; } else{ if(a[l] + a[r] != bf) return 0; } l ++, r --; } return 1; } v.pb(i); if(f(i + 1, q - 1)) return 1; v.pop_back(); if(f(i + 1, q)) return 1; return 0; } void _(ll &tt){ cin >> n >> m; for(ll i = 1; i <= n + m; i ++){ cin >> a[i]; } sort(a + 1, a + n + 1); f(); ll ind = 0; for(ll i = 1; i <= n + m; i ++){ if(ind < m and i == v[ind]){ ind ++; continue; } cout << a[i] << ' '; } } 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...