# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
92739 | janchomath | Bootfall (IZhO17_bootfall) | C++14 | 1085 ms | 504 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll int
#define f first
#define s second
#define pb push_back
using namespace std;
ll n,a[20005],dp[20005],sum,s,oo,x;
vector<ll>anss,v;
bool check(ll k){
v.clear();
s = 0;
for(int i=1; i<=n; i++)if(i != k)v.pb(a[i]),s += a[i];
if(s % 2 == 1)return false;
for(int i=1; i<=s; i++)dp[i] = 0;
dp[0] = 1;
for(int i=0; i<v.size(); i++){
for(int j=s; j>=0; j--){
dp[j + v[i]] = max(dp[j],dp[j + v[i]]);
if(dp[j + v[i]] && j + v[i] == s/2){
return true;
}
}
}
return false;
}
int main(){
std::ios::sync_with_stdio(false);
cin >> n;
for(int i=1; i<=n; i++){
cin >> a[i];
sum += a[i];
}
n++;
for(x=1; x<=sum; x++){
a[n] = x;
oo = 0;
for(int i=1; i<=n; i++){
if(!check(i)){
oo = 1;
break;
}
}
if(!oo){
anss.pb(x);
}
}
cout << anss.size() << endl;
for(int i=0; i<anss.size(); i++)cout << anss[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... |