QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#185963#5475. Make a LoopluanmengleiWA 6ms19260kbC++17777b2023-09-22 21:42:162023-09-22 21:42:17

Judging History

你现在查看的是最新测评结果

  • [2023-09-22 21:42:17]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:19260kb
  • [2023-09-22 21:42:16]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a, I = b; i <= I; ++i)
#define per(i, a, b) for (int i = a, I = b; i >= I; --i)
using namespace std;

const int N = 1000005;
int f[2][N], g[2][N];

void add(int &x, int y) { x = min(3, x + y); }

int main() {
	ios::sync_with_stdio(0), cin.tie(0);

    int n; cin >> n;

    int sum = 0;
    f[0][0] = 1;
    rep(i, 0, n - 1) {
        int x; cin >> x;
        memcpy(g, f, sizeof g);
        rep(o, 0, 1) {
            rep(s, 0, sum) {
                add(g[!o][s + x], f[o][s]);
            }
        }
        sum += x;
        memcpy(f, g, sizeof f);
    }

    if (sum % 2 || f[0][sum / 2] < 4) {
        cout << "No\n";
    } else {
        cout << "Yes\n";
    }

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 6ms
memory: 19260kb

input:

4
1 1 1 1

output:

No

result:

wrong answer 1st lines differ - expected: 'Yes', found: 'No'