# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
500836 | EliteCallsYou | Bootfall (IZhO17_bootfall) | C++17 | 1081 ms | 296 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
# include <bits/stdc++.h>
using namespace std ;
//############################################################################
# define read(a)/**/for(int i=0;i<int(sizeof(a)/sizeof(a[0]));i++){cin>>a[i];}
# define print(x)/**/for(auto zx:x){cout<<zx<<' ';}
const char* tochar(string a){return a.c_str();}
void files(){freopen("planting.in","r",stdin);freopen("planting.out","w",stdout);}
void speed(){ios_base::sync_with_stdio(false);cin.tie(0);}
long long gcd(long long a,long long b){if(!b){return a;}a%=b;return gcd(b,a);}
long long lcm(long long a,long long b){return a /gcd(a,b) * b;}
//###########################################################################
const int N = 3e5 + 5 ;
const long long MOD = 1e17+7 ;
//###########################################################################
void hack(){}
//###########################################################################
int main(){
int n, sum = 0 ; cin >> n ;
int ar[n+1] ;
for ( int i = 0 ; i < n ; i ++ ){
cin >> ar[i] ;
sum += ar[i] ;
}
vector < int > ans ;
for ( int cur = 1 ; cur < 1000 ; cur ++ ){
ar[n] = cur ;
sum ++ ;
bool ok = true ;
for ( int exl = 0 ; exl <= n ; exl ++ ){
if ( (sum-ar[exl])%2 ){
ok = false ;
break ;
}
int s = (sum-ar[exl])/2 ;
bool dp[s+1] = {false} ;
dp[0] = true ;
//////////////////////////////////
for ( int it = 0 ; it <= n ; it ++ ){
if ( it == exl ){continue;}
for ( int i = s-ar[it] ; i > -1 ; i -- ){
if ( dp[i] ){
dp[i+ar[it]] = true ;
}
}
}
//////////////////////////////////
if ( !dp[s] ){
ok = false ;
break ;
}
}
if ( ok ){
ans.push_back(cur) ;
}
}
cout << ans.size() << '\n' ;
for ( auto it : ans ){
cout << it << ' ' ;
}
}
컴파일 시 표준 에러 (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... |