# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
894574 | Andrey | Bootfall (IZhO17_bootfall) | C++14 | 936 ms | 17348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma GCC target("popcnt")
using namespace std;
bitset<501> idk[260001];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,sb = 0;
cin >> n;
vector<int> haha(n);
for(int i = 0; i < n; i++) {
cin >> haha[i];
sb+=haha[i];
}
for(int i = 0; i < 501; i++) {
idk[0][i] = 1;
}
for(int i = 0; i < n; i++) {
for(int j = 250000; j >= haha[i]; j--) {
bool a = idk[j][i];
idk[j]|=idk[j-haha[i]];
idk[j][i] = a;
}
}
vector<int> ans(0);
for(int i = 1; i <= 250000; i++) {
bool yeah = true;
if(sb%2 == 0) {
if(idk[sb/2][n] == 0) {
yeah = false;
}
for(int j = 0; j < n; j++) {
if((sb+i-haha[j])%2 == 1) {
yeah = false;
}
if((sb+i-haha[j])/2 > 250000 || idk[(sb+i-haha[j])/2][j] == 0) {
yeah = false;
}
}
if(yeah) {
ans.push_back(i);
}
}
}
cout << ans.size() << "\n";
for(int i = 0; i < ans.size(); i++) {
cout << ans[i] << " ";
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |