提交记录 6875


用户 题目 状态 得分 用时 内存 语言 代码长度
Kaizyn noip18b. 【NOIP2018】货币系统 Accepted 100 3.341 ms 48 KB C++ 765 B
提交时间 评测时间
2018-11-11 19:27:03 2020-08-01 00:52:18
#include <bits/stdc++.h>

using namespace std;

const int Maxn = 100+7;
const int Maxa = 25000+7;

int T, n, m;
int a[Maxn];
bitset<Maxa> need, now;

int main()
{
    scanf("%d", &T);
    while(T--)
    {
        m = 0;
        need.reset();
        now.reset();
        now.set(0);

        scanf("%d", &n);
        for(int i = 1; i <= n; ++i)
        {
            scanf("%d", a+i);
            need.set(a[i]);
        }
        sort(a+1, a+n+1);
        for(int i = 1; i <= n; ++i)
        {
            if(!now[a[i]])
            {
                m++;
                for(int j = 1; j*a[i] <= a[n]; ++j)
                    now |= now<<a[i];
                if((now&need) == need) break;
            }
        }
        printf("%d\n", m);
    }
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1147.24 us48 KBAcceptedScore: 5

Testcase #2186.89 us48 KBAcceptedScore: 5

Testcase #3162.87 us48 KBAcceptedScore: 5

Testcase #4223.08 us48 KBAcceptedScore: 5

Testcase #5478.9 us48 KBAcceptedScore: 5

Testcase #6242.32 us48 KBAcceptedScore: 5

Testcase #7464.8 us48 KBAcceptedScore: 5

Testcase #8196.39 us48 KBAcceptedScore: 5

Testcase #9525.67 us48 KBAcceptedScore: 5

Testcase #10455.3 us48 KBAcceptedScore: 5

Testcase #11221.72 us48 KBAcceptedScore: 5

Testcase #12207.99 us48 KBAcceptedScore: 5

Testcase #13180.24 us48 KBAcceptedScore: 5

Testcase #14315.84 us48 KBAcceptedScore: 5

Testcase #15313.44 us48 KBAcceptedScore: 5

Testcase #16317.27 us48 KBAcceptedScore: 5

Testcase #173.142 ms48 KBAcceptedScore: 5

Testcase #183.08 ms48 KBAcceptedScore: 5

Testcase #193.203 ms48 KBAcceptedScore: 5

Testcase #203.341 ms48 KBAcceptedScore: 5


Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:36:26 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠