QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#30855#3632. Izvanredna IsplatazyyWA 4ms3592kbC++1.4kb2022-05-01 17:51:042022-05-01 17:51:06

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-01 17:51:06]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3592kb
  • [2022-05-01 17:51:04]
  • 提交

answer

// Problem: 货币系统
// Contest: AcWing
// URL: https://www.acwing.com/problem/content/description/534/
// Memory Limit: 128 MB
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

// %%%Skyqwq
#include <bits/stdc++.h>

//#define int long long
#define help {cin.tie(NULL); cout.tie(NULL);}
#define pb push_back
#define fi first
#define se second
#define mkp make_pair
using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T> bool chkMax(T &x, T y) { return (y > x) ? x = y, 1 : 0; }
template <typename T> bool chkMin(T &x, T y) { return (y < x) ? x = y, 1 : 0; }

template <typename T> void inline read(T &x) {
    int f = 1; x = 0; char s = getchar();
    while (s < '0' || s > '9') { if (s == '-') f = -1; s = getchar(); }
    while (s <= '9' && s >= '0') x = x * 10 + (s ^ 48), s = getchar();
    x *= f;
}

const int N=25005;
int n,a[105],t;
bool f[N];
int main()
{
    for(cin>>t;t;t--)
    {
        cin>>n;
        for(int i=1;i<=n;i++)cin>>a[i];
        sort(a+1,a+1+n);
        int mx=a[n],res=0;
        memset(f,0,sizeof f);
        f[0]=true;
        for(int i=2;i<=n;i++)
        {
            if(f[a[i]])continue;
            res++;
            for(int j=a[i];j<=mx;j++)f[j]|=f[j-a[i]];
        }
        puts(res+1==n?"DA":"NE");
    }
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 4ms
memory: 3592kb

input:

100
10
1 2 3 12 13 22 23 33 43 53
10
1 6 15 20 23 29 30 39 40 45
10
1 2 3 4 6 8 14 18 28 38
10
1 2 4 5 8 11 14 23 32 41
10
1 2 3 4 7 11 16 20 29 38
10
1 2 3 5 6 7 11 16 25 34
10
1 2 3 4 5 6 7 9 10 15
10
1 7 16 21 28 38 47 53 62 67
10
1 4 5 12 17 19 29 30 33 36
10
1 2 3 4 5 7 9 11 13 19
10
1 2 3 4 5 ...

output:

NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE
NE

result:

wrong answer 1st lines differ - expected: 'DA', found: 'NE'