提交记录 11287
| 提交时间 |
评测时间 |
| 2019-11-13 15:23:31 |
2020-08-01 02:41:29 |
#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 | 118.15 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #2 | 95.53 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #3 | 95.51 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #4 | 113.42 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #5 | 111.58 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #6 | 101.94 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #7 | 127.06 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #8 | 123.35 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #9 | 141.99 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #10 | 161.3 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #11 | 149.74 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #12 | 147.38 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #13 | 144.59 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #14 | 213.08 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #15 | 242.77 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #16 | 213.79 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #17 | 1.623 ms | 56 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #18 | 1.646 ms | 56 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #19 | 1.64 ms | 56 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #20 | 1.66 ms | 56 KB | Accepted | Score: 5 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-03-28 01:42:57 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠