답안 #573109

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
573109 2022-06-05T19:34:31 Z StrawHatWess Uplifting Excursion (BOI22_vault) C++17
5 / 100
4882 ms 6504 KB
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
 
typedef vector<int>vi; 
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()

typedef pair<int,int>pi;
typedef vector<pi>vpi; 
#define fi first
#define se second
 
#define FOR(i,a,b) for(int i=a; i<b; i++)
#define ROF(i,a,b) for(int i=b-1; i>=a; i--)
 
template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
const int INF=2e9;
 
 
 
void IO() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout);
#endif
}
/////////////////////////ONLY CLEAN CODES ALLOWED/////////////////////////


const int MX=1e5+10; 
vi mp(MX*3,-1); 

int main(){
	IO(); boost; 


	int M; 
	long long L; 
	cin>>M>>L; 

	if(!(L+MX>=0 && L+MX<sz(mp))) { cout << "impossible" << endl; return 0; }
	 
	FOR(i,-M,M+1){
		int n; cin>>n; 
		while(n--){
			vpi vec; 
			FOR(x,0,MX*2) if(mp[x]!=-1){
				vec.pb({x+i, mp[x]+1}); 
			}

			for(auto it: vec){
				int k=it.fi, x=it.se; 
				ckmax(mp[k],x); 
			}

			ckmax(mp[i+MX],1); 
		}
	}


	if(mp[L+MX]==-1) cout << "impossible" << endl; 
	else cout << mp[L+MX] << endl;

	


}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1492 KB Output is correct
2 Correct 2 ms 1492 KB Output is correct
3 Correct 2 ms 1492 KB Output is correct
4 Correct 6 ms 1492 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1610 ms 3224 KB Output is correct
7 Correct 298 ms 1976 KB Output is correct
8 Correct 1385 ms 2704 KB Output is correct
9 Correct 4771 ms 3604 KB Output is correct
10 Correct 12 ms 1492 KB Output is correct
11 Correct 9 ms 1492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1492 KB Output is correct
2 Correct 2 ms 1492 KB Output is correct
3 Correct 2 ms 1492 KB Output is correct
4 Correct 6 ms 1492 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1610 ms 3224 KB Output is correct
7 Correct 298 ms 1976 KB Output is correct
8 Correct 1385 ms 2704 KB Output is correct
9 Correct 4771 ms 3604 KB Output is correct
10 Correct 12 ms 1492 KB Output is correct
11 Correct 9 ms 1492 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 1 ms 1492 KB Output is correct
14 Correct 1 ms 1492 KB Output is correct
15 Correct 6 ms 1492 KB Output is correct
16 Correct 1 ms 1492 KB Output is correct
17 Correct 1649 ms 3248 KB Output is correct
18 Correct 297 ms 2100 KB Output is correct
19 Correct 1420 ms 2544 KB Output is correct
20 Correct 4882 ms 3520 KB Output is correct
21 Correct 11 ms 1492 KB Output is correct
22 Correct 10 ms 1492 KB Output is correct
23 Correct 1 ms 1492 KB Output is correct
24 Runtime error 968 ms 6504 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1492 KB Output is correct
2 Incorrect 1 ms 1492 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1492 KB Output is correct
2 Incorrect 1 ms 1492 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1492 KB Output is correct
2 Incorrect 1 ms 1492 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1492 KB Output is correct
2 Correct 2 ms 1492 KB Output is correct
3 Correct 2 ms 1492 KB Output is correct
4 Correct 6 ms 1492 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1610 ms 3224 KB Output is correct
7 Correct 298 ms 1976 KB Output is correct
8 Correct 1385 ms 2704 KB Output is correct
9 Correct 4771 ms 3604 KB Output is correct
10 Correct 12 ms 1492 KB Output is correct
11 Correct 9 ms 1492 KB Output is correct
12 Correct 6 ms 1492 KB Output is correct
13 Incorrect 1 ms 1492 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1492 KB Output is correct
2 Incorrect 1 ms 1492 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1492 KB Output is correct
2 Correct 2 ms 1492 KB Output is correct
3 Correct 2 ms 1492 KB Output is correct
4 Correct 6 ms 1492 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1610 ms 3224 KB Output is correct
7 Correct 298 ms 1976 KB Output is correct
8 Correct 1385 ms 2704 KB Output is correct
9 Correct 4771 ms 3604 KB Output is correct
10 Correct 12 ms 1492 KB Output is correct
11 Correct 9 ms 1492 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 1 ms 1492 KB Output is correct
14 Correct 1 ms 1492 KB Output is correct
15 Correct 6 ms 1492 KB Output is correct
16 Correct 1 ms 1492 KB Output is correct
17 Correct 1649 ms 3248 KB Output is correct
18 Correct 297 ms 2100 KB Output is correct
19 Correct 1420 ms 2544 KB Output is correct
20 Correct 4882 ms 3520 KB Output is correct
21 Correct 11 ms 1492 KB Output is correct
22 Correct 10 ms 1492 KB Output is correct
23 Correct 1 ms 1492 KB Output is correct
24 Runtime error 968 ms 6504 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1492 KB Output is correct
2 Incorrect 1 ms 1492 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1492 KB Output is correct
2 Correct 2 ms 1492 KB Output is correct
3 Correct 2 ms 1492 KB Output is correct
4 Correct 6 ms 1492 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1610 ms 3224 KB Output is correct
7 Correct 298 ms 1976 KB Output is correct
8 Correct 1385 ms 2704 KB Output is correct
9 Correct 4771 ms 3604 KB Output is correct
10 Correct 12 ms 1492 KB Output is correct
11 Correct 9 ms 1492 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 1 ms 1492 KB Output is correct
14 Correct 1 ms 1492 KB Output is correct
15 Correct 6 ms 1492 KB Output is correct
16 Correct 1 ms 1492 KB Output is correct
17 Correct 1649 ms 3248 KB Output is correct
18 Correct 297 ms 2100 KB Output is correct
19 Correct 1420 ms 2544 KB Output is correct
20 Correct 4882 ms 3520 KB Output is correct
21 Correct 11 ms 1492 KB Output is correct
22 Correct 10 ms 1492 KB Output is correct
23 Correct 1 ms 1492 KB Output is correct
24 Runtime error 968 ms 6504 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -