Submission #1046573

# Submission time Handle Problem Language Result Execution time Memory
1046573 2024-08-06T17:28:06 Z vjudge1 Uplifting Excursion (BOI22_vault) C++17
0 / 100
5000 ms 524288 KB
#include <bits/stdc++.h>

using namespace std;

#define ar array
#define int long long
#define ld long double

const int N = 1e6 + 20;
const int X = 5e5 + 20;

const int LOG = 21;
const int INF = 1e17;


signed main(){ios::sync_with_stdio(false);cin.tie(0);	
	int n, m;
	cin>>n>>m;
	vector<int> v;
	for(int i = -n;i <= n;i++){
		int x;
		cin>>x;
		for(int j = 0;j < x;j++)v.push_back(i);
	}
	map<int,int> dp;
	dp[0] = 0;
	for(auto u: v){
		map<int, int> ndp = dp;
		for(auto [a, b]: dp){
			ndp[a + u] = max(ndp[a + u], b + 1);
		}
		dp = ndp;
	}
	if(dp.count(m))cout<<dp[m];
	else cout<<"impossible";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 456 KB Output is correct
5 Execution timed out 5093 ms 4812 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 456 KB Output is correct
5 Execution timed out 5093 ms 4812 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Runtime error 275 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Runtime error 275 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Runtime error 275 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 456 KB Output is correct
5 Execution timed out 5093 ms 4812 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Runtime error 275 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 456 KB Output is correct
5 Execution timed out 5093 ms 4812 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Runtime error 275 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 456 KB Output is correct
5 Execution timed out 5093 ms 4812 KB Time limit exceeded
6 Halted 0 ms 0 KB -