提交记录 11288
提交时间 |
评测时间 |
2019-11-13 15:23:46 |
2020-08-01 02:41:32 |
#include <bits/stdc++.h>
constexpr int N = 100 + 5;
int a[N];
std::bitset<25005> f;
inline char nc()
{
static char buf[1000000], *p1 = buf, *p2 = buf;
return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2) ? EOF : *p1++;
}
inline int read()
{
int res = 0;
char ch;
do ch = nc(); while (ch < 48 or ch > 57);
do res = res * 10 + ch - 48, ch = nc(); while (ch >= 48 && ch <= 57);
return res;
}
int main()
{
int T = read();
while (T--)
{
int n = read(), ans = n;
for (int i = 0; i < n; ++i) a[i] = read();
std::sort(a, a + n);
f.reset();
f[0] = 1;
for (int i = 0; i < n; ++i)
{
if (f[a[i]]) --ans;
else
{
int bound = a[n - 1] / a[i];
for (int j = 1; j <= bound; bound -= j, j <<= 1) f |= f << (j * a[i]);
f |= f << (bound * a[i]);
}
}
printf("%d\n", ans);
}
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 105.35 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #2 | 88.91 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #3 | 88.82 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #4 | 110.92 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #5 | 109.9 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #6 | 107.34 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #7 | 126.77 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #8 | 123.37 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #9 | 144.6 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #10 | 203.22 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #11 | 150.75 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #12 | 144.64 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #13 | 144.12 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #14 | 214.57 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #15 | 249.4 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #16 | 246.5 us | 48 KB | Accepted | Score: 5 | 显示更多 |
Testcase #17 | 1.575 ms | 56 KB | Accepted | Score: 5 | 显示更多 |
Testcase #18 | 1.649 ms | 56 KB | Accepted | Score: 5 | 显示更多 |
Testcase #19 | 1.634 ms | 56 KB | Accepted | Score: 5 | 显示更多 |
Testcase #20 | 1.641 ms | 56 KB | Accepted | Score: 5 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:30:35 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠