# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
862478 | 2023-10-18T10:26:30 Z | AtabayRajabli | Table Tennis (info1cup20_tabletennis) | C++11 | 3000 ms | 4464 KB |
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> // author : AtabeyR #define pb push_back #define pii pair<int, int> #define pll pair<ll, ll> #define all(v) v.begin(), v.end() #define OPT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define sec second #define fi first #define int ll #define print(k) cerr << "Ans : "; cout << k << endl; #define ins insert #define bpc __builtin_popcountll #define skip continue #define endll '\n' #define gcd(a, b) __gcd(a, b) #define lcm(a, b) a*b / (__gcd(a, b)) typedef long long ll; typedef unsigned long long ull; const int oo = 0x3F3F3F3F; const int ooo = 0x3F3F3F3F3F3F3F3FLL; const int mod = 998244353; const int sz = 2e5; using namespace std; using namespace __gnu_pbds; template<class T> using ordered_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>; void open(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } int n, m, k, a[sz]; vector<int> f(int s, int e, int rem) { int ls = s, rs = e, team = 1; s++; e--; vector<int> v; v.pb(a[s-1]); v.pb(a[e+1]); while(s < e) { if(a[s] - a[ls] < a[rs] - a[e]) { rem--; s++; } else if(a[s] - a[ls] > a[rs] - a[e]) { rem--; e--; } else { ls = s; rs = e; v.pb(a[ls]); v.pb(a[rs]); team++; s++; e--; } if(team == n / 2){rem = 0; break;} } vector<int> tmp; if(rem < 0 || rem % 2)return tmp; sort(all(v)); return v; } void solve() { cin >> n >> k; for(int i = 1; i<=n+k; i++)cin >> a[i]; for(int i = 0; i<=k; i++) { for(int j = 0; j<=i; j++) { vector<int> g = f(j+1, n+k-(i-j), k-i); if(g.empty())skip; for(int i : g)cout << i << " "; return; } } } int32_t main() { // open("i"); OPT int t = 1; // cin >> t; for(int i = 1; i<=t; i++) solve(); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 992 KB | Output is correct |
2 | Correct | 29 ms | 4464 KB | Output is correct |
3 | Correct | 25 ms | 4304 KB | Output is correct |
4 | Correct | 25 ms | 4296 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 4308 KB | Output is correct |
2 | Correct | 31 ms | 4296 KB | Output is correct |
3 | Correct | 25 ms | 4208 KB | Output is correct |
4 | Correct | 26 ms | 4284 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 2 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 600 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 2 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 120 ms | 4304 KB | Output is correct |
3 | Correct | 53 ms | 4312 KB | Output is correct |
4 | Correct | 53 ms | 4228 KB | Output is correct |
5 | Correct | 37 ms | 4440 KB | Output is correct |
6 | Correct | 30 ms | 4300 KB | Output is correct |
7 | Correct | 34 ms | 4296 KB | Output is correct |
8 | Correct | 29 ms | 4308 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 77 ms | 348 KB | Output is correct |
2 | Execution timed out | 3068 ms | 1644 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |