| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 598438 | SuffixAutomata | Bootfall (IZhO17_bootfall) | C++17 | 556 ms | 3708 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int dp[500 * 500 + 1], dp2[500 * 500 + 1];
bool ok[500 * 500 + 1];
int main() {
int n;
cin >> n;
vector<int> ar(n);
int sm = 0;
dp[0] = 1;
for (int i = 0; i < n; i++) {
cin >> ar[i];
for (int j = sm; j >= 0; j--)
dp[j + ar[i]] = (dp[j + ar[i]] + dp[j]) % MOD;
sm += ar[i];
}
auto x = [&](int i) {
if (i < 0 || i % 2 || i / 2 > sm)
return 0;
return dp2[i / 2];
};
vector<int> ans;
if (sm % 2 == 0 && dp[sm / 2]) {
for (int v = 0; v <= 500 * 500; v++)
ok[v] = 1;
for (int i : ar) {
memcpy(dp2, dp, sizeof dp2);
for (int j = 0; j <= sm - i; j++)
dp2[j + i] = (dp2[j + i] + MOD - dp2[j]) % MOD;
for (int v = 0; v <= 500 * 500; v++)
ok[v] = ok[v] && ((x(sm + v - i) + x(sm - v - i)) % MOD);
}
for (int v = 0; v <= 500 * 500; v++)
if (ok[v])
ans.push_back(v);
}
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++)
cout << ans[i] << " \n"[i == ans.size() - 1];
}
컴파일 시 표준 에러 (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... | ||||
