#include "bits/stdc++.h"
#define ll long long
using namespace std;
const ll mod = 1000000007;
int b[150001], cnt[150001];
signed main () {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// freopen("cowland.in","r",stdin);
// freopen("cowland.out","w",stdout);
int n, k;
cin >> n >> k;
vector<pair<int, int>> v;
set<int> ss;
for(int i = 0; i < n + k; i++) {
int x;
cin >> x;
ss.insert(x);
v.push_back({x, i + 1});
}
map<int, int> c;
int o = 1;
for(int i : ss)
c[i] = o++;
for(int i = 0; i < n + k; i++) {
cnt[c[v[i].first]]++;
}
sort(v.begin(), v.end());
set<int> s;
for(int i = 0; i <= k; i++) {
int j = n + k - 1;
while(i < j && i + ((n + k) - j - 1) <= k)
s.insert(v[i].first + v[j--].first);
}
map<int, int> mp;
for(int x : s) {
int y = 0;
for(int i = 0; i < n + k; i++) {
if(cnt[c[v[i].first]] - b[c[v[i].first]] && x - v[i].first >= 0 && cnt[c[x - v[i].first]] - b[c[x - v[i].first]]) {
b[c[v[i].first]]++, b[c[x - v[i].first]]++;
y += 2;
if(y == n)
break;
}
}
if(y >= n) {
set<int> ans;
for(int i = 0; i < n + k; i++) {
if(b[c[v[i].first]]) {
b[c[v[i].first]]--;
ans.insert(v[i].second);
}
}
for(int i : ans)
cout << i << " ";
return 0;
}
for(int i = 0; i < n + k; i++)
mp[v[i].first] = 0, b[c[v[i].first]] = 0;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
852 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
3528 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
401 ms |
43680 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
468 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
4084 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |