#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define int long long
const int sz = 4e5 + 5;
const int mod = 1e9 + 7;
signed main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, m;
cin >> n >> m;
vector<int>v(n + m);
map<int, int>mp;
for (int i = 0; i <= n; i++) {
cin >> v[i];
mp[v[i]] = i + 1;
}
sort(all(v));
int sum1 = 0, sum2 = 0;
int l = 0, r = n - 1;
while (l < r) {
if (l % 2 == 0) {
sum1 += v[l] + v[r];
}
else sum2 += v[l] + v[r];
l++;
r--;
}
if (sum1 == sum2) {
for (int i = 0; i < n; i++) {
cout << mp[v[i]] << ' ';
}
return 0;
}
for (int i = 0; i < n; i++) {
swap(v[i], v[n]);
sort(v.begin(), v.begin() + n);
sum1 = 0, sum2 = 0;
l = 0, r = n - 1;
while (l < r) {
if (l % 2 == 0) {
sum1 += v[l] + v[r];
}
else sum2 += v[l] + v[r];
l++;
r--;
}
if (sum1 == sum2) {
for (int i = 0; i < n; i++) {
cout << mp[v[i]] << ' ';
}
return 0;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
468 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2797 ms |
1724 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3030 ms |
10828 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |