# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
862468 | aykhn | Table Tennis (info1cup20_tabletennis) | C++14 | 52 ms | 5864 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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];
bool f(int start, int end, int rem)
{
int s = start, e = end, ls = s, rs = e;
s++;
e--;
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
{
s++;
e--;
}
if(rem < 0)break;
}
if (s == e) rem--;
if(rem < 0 || rem % 2)return 0;
s = start + 1;
e = end - 1;
ls = start;
rs = end;
vector<int> l, r;
l.pb(a[ls]);
r.pb(a[rs]);
while(s < e)
{
if(a[s] - a[ls] < a[rs] - a[e])
{
s++;
}
else if(a[s] - a[ls] > a[rs] - a[e])
{
e--;
}
else
{
if (l.size() < n/2)
{
l.pb(a[s]);
r.pb(a[e]);
}
s++;
e--;
}
}
for(int i : l)cout << i << " ";
reverse(all(r));
for(int i : r)cout << i << " ";
return 1;
}
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++)
{
if(f(j+1, n+k-(i-j), k-i))return;
}
}
}
int32_t main()
{
// open("i");
OPT
int t = 1;
// cin >> t;
for(int i = 1; i<=t; i++)
solve();
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |