QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#744701#5475. Make a LoopmingggWA 1ms3800kbC++141.3kb2024-11-13 22:54:552024-11-13 22:55:03

Judging History

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

  • [2024-11-13 22:55:03]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3800kb
  • [2024-11-13 22:54:55]
  • 提交

answer

#include "bits/stdc++.h"

using namespace std;

#define ln "\n"
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define int long long
const int MOD = 1e9 + 7;
const int inf = 2e18;
const int N = 105;
const int M = 1e6 + 7;
int n, a[N], s, f[M][2][2];

signed main() {
    cin.tie(0) -> sync_with_stdio(0);
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i], s += a[i];
    if(s % 2 != 0 or n % 2 != 0) {
        cout << "NO";
        return 0;
    }
    s /= 2;
    f[0][0][0] = 1;
    for(int k = 1; k <= n; k++) {
        int id = k % 2;
        for(int i = 0; i <= s; i++) {
            for(int j = 0; j < 2; j++) {
                f[i][id][j] = f[i][id ^ 1][j];
                if(f[i][id][j] > 4) f[i][id][j] = 4;
            }
            if(i >= a[k]) {
                for(int j = 0; j < 2; j++) {
                    f[i][id][j] += f[i - a[k]][id ^ 1][j ^ 1];
                    if(f[i][id][j] > 4) f[i][id][j] = 4;
                }
            }
            // cout << i << ' ' << k << ' ' << f[i][id][1] << ' ' << f[i][id][0] << ln;
        }
    }
    if(f[s][0][n % 2] >= 4) cout << "YES";
    else cout << "NO";
    cerr << "\nTime: " << clock() * 1000 / CLOCKS_PER_SEC;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3800kb

input:

4
1 1 1 1

output:

YES

result:

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