이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <fstream>
#include <iterator>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <cctype>
#include <string>
#include <cassert>
#include <set>
#include <bitset>
#include <unordered_set>
#include <numeric>
using ll = int64_t;
#define pb push_back
#define all(a) a.begin(),a.end()
#define ppi pair<int,pair<int,int>>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//#define int int64_t
// xcode cant include bits/stdc++.h
using namespace std;
/* /\_/\
* (= ._.)
* / > \>
*/
// encouraging cat
//const int INF = 10000000000000000;
//const int mod = 1000000007;
const int mod = 998244353;
const int MAXN = 100005;
//ifstream fin("trenuri.in");
//ofstream fout("trenuri.out");
unordered_map<int,int> mp;
unordered_map<int,int> occ;
int32_t main() {
fast
int n,k;
cin >> n >> k;
vector<int> a(n + k);
for (int i = 0;i < n + k;i++)
{
cin >> a[i];
occ[a[i]]++;
}
int l = 0;
int p = 0;
for (l = 0;l < n + k;l++)
{
if (l > k)
p++;
for (int i = n + k - p - 1;i >= 0 && i >= n - l - 1 && i > l;i--)
{
mp[a[l] + a[i]]++;
}
//r++;
}
int res = -1;
for (auto it:mp)
{
if (it.second >= n / 2)
{
res = it.first;
break;
}
}
//cout << res << '\n';
//assert(res != -1);
int cnt = 0;
for (int i = 0;i < n + k;i++)
{
if (occ[res - a[i]] > 0)
{
cout << a[i] << " ";
cnt++;
}
if (cnt == n)
break;
}
cout << '\n';
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
tabletennis.cpp:31:9: warning: "/*" within comment [-Wcomment]
31 | /* /\_/\
|
# | 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... |