QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#623513#8790. First Billionrns_ksr#WA 0ms3544kbC++141.1kb2024-10-09 12:34:532024-10-09 12:34:55

Judging History

你现在查看的是最新测评结果

  • [2024-10-09 12:34:55]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3544kb
  • [2024-10-09 12:34:53]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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