| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 337922 | kutbilim_one | Bootfall (IZhO17_bootfall) | C++14 | 1092 ms | 34132 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/** kutbilim.one **/
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define int long long
#define endl '\n'
/*
ifstream in("test.txt");
#define cin in */
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
vector<int> a(n);
int sum = 0;
for(int i = 0; i < n; i++)
cin >> a[i], sum += a[i];
sort(all(a));
map<int, set<int>> cnt;
int MAX = sum;
vector<int> dp(MAX+1);
dp[0] = 1;
for(int k = 0; k < n; k++){
for(int x = MAX-a[k]; x >= 0; x--){
dp[x+a[k]] |= dp[x];
}
}
int good = false;
for(int left = 0, right; left <= MAX; left++){
if(!dp[left]) continue;
right = MAX-left;
if(left == right) good = true;
}
if(!good) goto breaker;
for(int ex = 0; ex < n; ex++){
MAX = sum-a[ex];
vector<int> pd(MAX+1);
pd[0] = 1;
for(int k = 0; k < n; k++){
if(k == ex) continue;
for(int x = MAX-a[k]; x >= 0; x--){
pd[x+a[k]] |= pd[x];
}
}
for(int left = 1, right; left <= MAX; left++){
if(!pd[left]) continue;
right = MAX-left;
cnt[abs(left-right)].insert(ex);
}
}
breaker:;
stringstream resultOut;
int sizeOut = 0;
for(auto i : cnt){
if(i.second.size() == n)
resultOut << i.first << " ", sizeOut++;
}
cout << sizeOut << endl << resultOut.str();
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... | ||||
