#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ll = long long;
using pi = pair<int,int>;
#define ST first
#define ND second
#define PB push_back
const int nax = 150 * 1000 + 10 + 400;
int n, k;
int w[nax];
int main() {
//ios_base::sync_with_stdio(0);
//cin.tie(0);
cin >> n >> k;
for(int i = 1; i <= n + k; ++i) cin >> w[i];
for(int l = 0; l <= k; ++l) {
for(int r = 0; r + l <= k; ++r) {
int lt = k - (l + r);
int a = l + 1, b = n + k - r;
int sum = w[a] + w[b];
vi ans = {a, b};
bool ok = 1;
while(a + 1 < b) {
a++;
b--;
while(w[a] + w[b] != sum) {
if(w[a] + w[b] > sum) {
b--;
lt--;
if(lt < 0) {
ok = 0;
break;
}
} else {
a++;
lt--;
if(lt < 0) {
ok = 0;
break;
}
}
}
ans.PB(a);
ans.PB(b);
if(!ok) break;
}
if(ok) {
while(lt > 0) {
ans.pop_back();
ans.pop_back();
lt -= 2;
}
sort(ans.begin(), ans.end());
for(int x : ans) cout << x << " ";
return 0;
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
20 ms |
896 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
145 ms |
4064 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |