Submission #679676

# Submission time Handle Problem Language Result Execution time Memory
679676 2023-01-08T22:12:47 Z YENGOYAN Bootfall (IZhO17_bootfall) C++17
13 / 100
155 ms 19380 KB
/*
	//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\
	\\                                    //
	//  271828___182845__904523__53602__  \\
	\\  87___47____13______52____66__24_  //
	//  97___75____72______47____09___36  \\
	\\  999595_____74______96____69___67  //
	//  62___77____24______07____66__30_  \\
	\\  35___35____47______59____45713__  //
	//                                    \\
	\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\//
												*/

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <climits>
#include <algorithm>
#include <random>
#include <queue>
#include <deque>
#include <iomanip>
#include <string>
#include <tuple>
#include <bitset>
#include <chrono>
#include <ctime>
#include <fstream>
#include <stack>
#include <cstdio>

using namespace std;
using ll = long long;
const int N = 3e5 + 5;
const ll mod = 1e9 + 7, inf = 1e12;

void solve() {
	// start time - 1:05
	int n; cin >> n;
	vector<int> v(n + 1);
	int sm = 0;
	int mx = 0;
	for (int i = 1; i <= n; ++i) {
		cin >> v[i];
		sm += v[i];
		mx = max(mx, v[i]);
	}
	map<int, int> mp;
	mx = 270;
	for (int ii = 0; ii <= n; ++ii) {
		int cur = sm - v[ii];
		vector<vector<int>> dp(n + 1, vector<int>(mx * mx + 5));
		dp[0][0] = 1;
		set<int> odd, ev;
		for (int i = 1; i <= n; ++i) {
			dp[i] = dp[i - 1];
			if (i == ii) continue;
			vector<int> dp_ = dp[i];
			for (int j = 0; j + v[i] <= 1400; ++j) {
				dp_[j + v[i]] |= dp[i][j];
			}
			dp[i] = dp_;
		}
		for (int j = 1; j <= 1400; ++j) {
			if (!ii && (cur % 2 || !dp[n][cur / 2])) {
				//cout << dp[1][1] << "\n";
				cout << "0\n";
				return;
			}
			if (ii) {
				if ((cur + j) % 2) continue;
				if (dp[n][(cur + j) / 2]) ++mp[j];

			}
		}
	}
	int c = 0;
	for (pair<int, int> x : mp) {
		if (x.second == n) ++c;
	}
	cout << c << "\n";
	for (pair<int, int> x : mp) {
		if (x.second == n) cout << x.first << " ";
	}
}
 
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	//int t; cin >> t;
	//while (t--)
		solve();
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2024 KB Output is correct
2 Correct 6 ms 2612 KB Output is correct
3 Correct 1 ms 1748 KB Output is correct
4 Correct 5 ms 2020 KB Output is correct
5 Correct 28 ms 4396 KB Output is correct
6 Correct 13 ms 3212 KB Output is correct
7 Correct 7 ms 2612 KB Output is correct
8 Correct 25 ms 4404 KB Output is correct
9 Correct 15 ms 3800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2024 KB Output is correct
2 Correct 6 ms 2612 KB Output is correct
3 Correct 1 ms 1748 KB Output is correct
4 Correct 5 ms 2020 KB Output is correct
5 Correct 28 ms 4396 KB Output is correct
6 Correct 13 ms 3212 KB Output is correct
7 Correct 7 ms 2612 KB Output is correct
8 Correct 25 ms 4404 KB Output is correct
9 Correct 15 ms 3800 KB Output is correct
10 Correct 139 ms 9556 KB Output is correct
11 Correct 137 ms 9556 KB Output is correct
12 Correct 155 ms 9548 KB Output is correct
13 Correct 123 ms 8404 KB Output is correct
14 Correct 140 ms 8992 KB Output is correct
15 Correct 124 ms 8948 KB Output is correct
16 Correct 153 ms 9556 KB Output is correct
17 Correct 47 ms 6108 KB Output is correct
18 Correct 93 ms 7848 KB Output is correct
19 Correct 121 ms 8408 KB Output is correct
20 Correct 142 ms 9556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2024 KB Output is correct
2 Correct 6 ms 2612 KB Output is correct
3 Correct 1 ms 1748 KB Output is correct
4 Correct 5 ms 2020 KB Output is correct
5 Correct 28 ms 4396 KB Output is correct
6 Correct 13 ms 3212 KB Output is correct
7 Correct 7 ms 2612 KB Output is correct
8 Correct 25 ms 4404 KB Output is correct
9 Correct 15 ms 3800 KB Output is correct
10 Correct 139 ms 9556 KB Output is correct
11 Correct 137 ms 9556 KB Output is correct
12 Correct 155 ms 9548 KB Output is correct
13 Correct 123 ms 8404 KB Output is correct
14 Correct 140 ms 8992 KB Output is correct
15 Correct 124 ms 8948 KB Output is correct
16 Correct 153 ms 9556 KB Output is correct
17 Correct 47 ms 6108 KB Output is correct
18 Correct 93 ms 7848 KB Output is correct
19 Correct 121 ms 8408 KB Output is correct
20 Correct 142 ms 9556 KB Output is correct
21 Incorrect 11 ms 19380 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2024 KB Output is correct
2 Correct 6 ms 2612 KB Output is correct
3 Correct 1 ms 1748 KB Output is correct
4 Correct 5 ms 2020 KB Output is correct
5 Correct 28 ms 4396 KB Output is correct
6 Correct 13 ms 3212 KB Output is correct
7 Correct 7 ms 2612 KB Output is correct
8 Correct 25 ms 4404 KB Output is correct
9 Correct 15 ms 3800 KB Output is correct
10 Correct 139 ms 9556 KB Output is correct
11 Correct 137 ms 9556 KB Output is correct
12 Correct 155 ms 9548 KB Output is correct
13 Correct 123 ms 8404 KB Output is correct
14 Correct 140 ms 8992 KB Output is correct
15 Correct 124 ms 8948 KB Output is correct
16 Correct 153 ms 9556 KB Output is correct
17 Correct 47 ms 6108 KB Output is correct
18 Correct 93 ms 7848 KB Output is correct
19 Correct 121 ms 8408 KB Output is correct
20 Correct 142 ms 9556 KB Output is correct
21 Incorrect 11 ms 19380 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2024 KB Output is correct
2 Correct 6 ms 2612 KB Output is correct
3 Correct 1 ms 1748 KB Output is correct
4 Correct 5 ms 2020 KB Output is correct
5 Correct 28 ms 4396 KB Output is correct
6 Correct 13 ms 3212 KB Output is correct
7 Correct 7 ms 2612 KB Output is correct
8 Correct 25 ms 4404 KB Output is correct
9 Correct 15 ms 3800 KB Output is correct
10 Correct 139 ms 9556 KB Output is correct
11 Correct 137 ms 9556 KB Output is correct
12 Correct 155 ms 9548 KB Output is correct
13 Correct 123 ms 8404 KB Output is correct
14 Correct 140 ms 8992 KB Output is correct
15 Correct 124 ms 8948 KB Output is correct
16 Correct 153 ms 9556 KB Output is correct
17 Correct 47 ms 6108 KB Output is correct
18 Correct 93 ms 7848 KB Output is correct
19 Correct 121 ms 8408 KB Output is correct
20 Correct 142 ms 9556 KB Output is correct
21 Incorrect 11 ms 19380 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2024 KB Output is correct
2 Correct 6 ms 2612 KB Output is correct
3 Correct 1 ms 1748 KB Output is correct
4 Correct 5 ms 2020 KB Output is correct
5 Correct 28 ms 4396 KB Output is correct
6 Correct 13 ms 3212 KB Output is correct
7 Correct 7 ms 2612 KB Output is correct
8 Correct 25 ms 4404 KB Output is correct
9 Correct 15 ms 3800 KB Output is correct
10 Correct 139 ms 9556 KB Output is correct
11 Correct 137 ms 9556 KB Output is correct
12 Correct 155 ms 9548 KB Output is correct
13 Correct 123 ms 8404 KB Output is correct
14 Correct 140 ms 8992 KB Output is correct
15 Correct 124 ms 8948 KB Output is correct
16 Correct 153 ms 9556 KB Output is correct
17 Correct 47 ms 6108 KB Output is correct
18 Correct 93 ms 7848 KB Output is correct
19 Correct 121 ms 8408 KB Output is correct
20 Correct 142 ms 9556 KB Output is correct
21 Incorrect 11 ms 19380 KB Output isn't correct
22 Halted 0 ms 0 KB -