답안 #925214

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
925214 2024-02-11T04:25:23 Z atom Bootfall (IZhO17_bootfall) C++17
13 / 100
1000 ms 700 KB
#include "bits/stdc++.h"
// @JASPER'S BOILERPLATE
using namespace std;
using ll = long long;

#ifdef JASPER
#include "debug.h"
#else
#define debug(...) 166
#endif

const int N = 505;
int n;
int a[N];

signed main() {
    cin.tie(0) -> sync_with_stdio(0);
    
    #ifdef JASPER
        freopen("in1", "r", stdin);
    #endif

    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];

    int sz = accumulate(a + 1, a + 1 + n, 0);
	sz *= 2;
    vector <int> ans;
    for (int x = 1; x <= sz; ++x) {

    	bool able = 1;
    	for (int k = 0; k <= n; ++k) {
    		swap(a[k], x);
    		vector <int> dp(sz + 5, 0);
    		dp[0] = 1;
    		for (int i = 1; i <= n; ++i)
	    		for (int j = sz; j >= a[i]; --j)
	    			dp[j] |= dp[j - a[i]];
    		
    		int tar = accumulate(a + 1, a + 1 + n, 0);
    		if (tar % 2 || (dp[tar / 2] == 0))
    			able = 0;
    		swap(a[k], x);
    	} 
    	
    	if (able) ans.push_back(x);
    }
    cout << (int) (ans.size()) << "\n";
    for (int x : ans) cout << x << " ";
}

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 18 ms 344 KB Output is correct
5 Correct 203 ms 444 KB Output is correct
6 Correct 5 ms 348 KB Output is correct
7 Correct 7 ms 348 KB Output is correct
8 Correct 605 ms 700 KB Output is correct
9 Correct 54 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 18 ms 344 KB Output is correct
5 Correct 203 ms 444 KB Output is correct
6 Correct 5 ms 348 KB Output is correct
7 Correct 7 ms 348 KB Output is correct
8 Correct 605 ms 700 KB Output is correct
9 Correct 54 ms 348 KB Output is correct
10 Correct 474 ms 448 KB Output is correct
11 Correct 95 ms 436 KB Output is correct
12 Correct 223 ms 344 KB Output is correct
13 Correct 74 ms 596 KB Output is correct
14 Correct 114 ms 440 KB Output is correct
15 Correct 64 ms 348 KB Output is correct
16 Correct 100 ms 436 KB Output is correct
17 Correct 19 ms 344 KB Output is correct
18 Correct 63 ms 444 KB Output is correct
19 Correct 43 ms 348 KB Output is correct
20 Correct 526 ms 436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 18 ms 344 KB Output is correct
5 Correct 203 ms 444 KB Output is correct
6 Correct 5 ms 348 KB Output is correct
7 Correct 7 ms 348 KB Output is correct
8 Correct 605 ms 700 KB Output is correct
9 Correct 54 ms 348 KB Output is correct
10 Correct 474 ms 448 KB Output is correct
11 Correct 95 ms 436 KB Output is correct
12 Correct 223 ms 344 KB Output is correct
13 Correct 74 ms 596 KB Output is correct
14 Correct 114 ms 440 KB Output is correct
15 Correct 64 ms 348 KB Output is correct
16 Correct 100 ms 436 KB Output is correct
17 Correct 19 ms 344 KB Output is correct
18 Correct 63 ms 444 KB Output is correct
19 Correct 43 ms 348 KB Output is correct
20 Correct 526 ms 436 KB Output is correct
21 Execution timed out 1050 ms 604 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 18 ms 344 KB Output is correct
5 Correct 203 ms 444 KB Output is correct
6 Correct 5 ms 348 KB Output is correct
7 Correct 7 ms 348 KB Output is correct
8 Correct 605 ms 700 KB Output is correct
9 Correct 54 ms 348 KB Output is correct
10 Correct 474 ms 448 KB Output is correct
11 Correct 95 ms 436 KB Output is correct
12 Correct 223 ms 344 KB Output is correct
13 Correct 74 ms 596 KB Output is correct
14 Correct 114 ms 440 KB Output is correct
15 Correct 64 ms 348 KB Output is correct
16 Correct 100 ms 436 KB Output is correct
17 Correct 19 ms 344 KB Output is correct
18 Correct 63 ms 444 KB Output is correct
19 Correct 43 ms 348 KB Output is correct
20 Correct 526 ms 436 KB Output is correct
21 Execution timed out 1050 ms 604 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 18 ms 344 KB Output is correct
5 Correct 203 ms 444 KB Output is correct
6 Correct 5 ms 348 KB Output is correct
7 Correct 7 ms 348 KB Output is correct
8 Correct 605 ms 700 KB Output is correct
9 Correct 54 ms 348 KB Output is correct
10 Correct 474 ms 448 KB Output is correct
11 Correct 95 ms 436 KB Output is correct
12 Correct 223 ms 344 KB Output is correct
13 Correct 74 ms 596 KB Output is correct
14 Correct 114 ms 440 KB Output is correct
15 Correct 64 ms 348 KB Output is correct
16 Correct 100 ms 436 KB Output is correct
17 Correct 19 ms 344 KB Output is correct
18 Correct 63 ms 444 KB Output is correct
19 Correct 43 ms 348 KB Output is correct
20 Correct 526 ms 436 KB Output is correct
21 Execution timed out 1050 ms 604 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 18 ms 344 KB Output is correct
5 Correct 203 ms 444 KB Output is correct
6 Correct 5 ms 348 KB Output is correct
7 Correct 7 ms 348 KB Output is correct
8 Correct 605 ms 700 KB Output is correct
9 Correct 54 ms 348 KB Output is correct
10 Correct 474 ms 448 KB Output is correct
11 Correct 95 ms 436 KB Output is correct
12 Correct 223 ms 344 KB Output is correct
13 Correct 74 ms 596 KB Output is correct
14 Correct 114 ms 440 KB Output is correct
15 Correct 64 ms 348 KB Output is correct
16 Correct 100 ms 436 KB Output is correct
17 Correct 19 ms 344 KB Output is correct
18 Correct 63 ms 444 KB Output is correct
19 Correct 43 ms 348 KB Output is correct
20 Correct 526 ms 436 KB Output is correct
21 Execution timed out 1050 ms 604 KB Time limit exceeded
22 Halted 0 ms 0 KB -