답안 #552584

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
552584 2022-04-23T11:28:08 Z QwertyPi Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 360 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;
const int N = 2001;
int dp[N];
int s[N], A[N];
vector<int> vals[N];
int32_t main(){
	int n, a, b;
	cin >> n >> a >> b;
	vals[0].push_back(0);
	for(int i = 1; i <= n; i++) cin >> A[i], s[i] = s[i - 1] + A[i];
	for(int i = 1; i <= n; i++){
		if(i >= a){
			for(int j = max(0LL, i - b); j <= i - a; j++){
				for(auto v : vals[j]){
					vals[i].push_back(v | (s[i] - s[j]));
				}
			}
		}
		sort(vals[i].begin(), vals[i].end());
		vals[i].resize(unique(vals[i].begin(), vals[i].end()) - vals[i].begin());
		// for(auto j : vals[i]) cout << j << ' '; cout << endl;
	}
	cout << vals[n].front() << endl;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 356 KB Output is correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Incorrect 1 ms 360 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 356 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 352 KB Output is correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 356 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -