QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#623513 | #8790. First Billion | rns_ksr# | WA | 0ms | 3544kb | C++14 | 1.1kb | 2024-10-09 12:34:53 | 2024-10-09 12:34:55 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define N 150
int A[N], Id[N], vis[N];
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; i++) cin >> A[i];
iota(Id, Id + n + 1, 0);
sort(Id, Id + n, [&](int a, int b) {
return (A[a] < A[b]);
});
fill(vis, vis + n + 5, 0);
int s = 0, m = min(n, 23);
for (int i = n - 1; i >= m; i--) {
int u = Id[i];
if (s > 0) {
vis[u] = 1;
s -= A[u];
}
else {
vis[u] = 0;
s += A[u];
}
}
int up = 1 << m;
for (int i = 0; i < up; i++) {
int ss = s;
for (int j = 0; j < m; j++) {
int u = Id[j];
int t = ((i >> j) & 1);
vis[u] = t;
if (t) ss -= A[u];
else ss += A[u];
}
if (!ss) {
break;
}
}
vector<int> ans;
for (int i = 1; i <= n; i++) if (!vis[i]) {
s += A[i];
ans.push_back(i);
}
cout << ans.size() << ' ';
for (auto e : ans) cout << e << ' ';
cout << endl;
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3544kb
input:
10 386413329 88494216 245947398 316438989 192751270 204627269 65749456 3938400 150458676 345180997
output:
5 4 5 6 8 10
result:
wrong answer need sum 1000000000, got sum 1062936925