提交记录 9800
| 用户 | 题目 | 状态 | 得分 | 用时 | 内存 | 语言 | 代码长度 |
|---|---|---|---|---|---|---|---|
| GavinZheng | noi19c. 【NOI2019】序列 | Time Limit Exceeded | 20 | 1 s | 549120 KB | C++11 | 1.67 KB |
| 提交时间 | 评测时间 |
|---|---|
| 2019-07-16 14:14:09 | 2020-08-01 01:52:28 |
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#define ll long long
using namespace std;
ll n,k,l;
struct gg {
ll va,id;
}a[20],b[20],aa[20],bb[20];
int cnt=0;
ll mx=0;
bool cop(gg x,gg y){return x.va>y.va;}
int main() {
// freopen("sequence.in","r",stdin);
// freopen("sequence.out","w",stdout);
int t;scanf("%d",&t);
for(int y=1;y<=t;y++) {
mx=0;
scanf("%lld%lld%lld", &n, &k, &l);
for (int i = 1; i <= n; i++) {
scanf("%lld", &a[i].va);
a[i].id = i;aa[i]=a[i];
}
for (int i = 1; i <= n; i++) {
scanf("%lld", &b[i].va);
b[i].id = i;bb[i]=b[i];
}
sort(a + 1, a + n + 1, cop);
sort(b + 1, b + n + 1, cop);
for (int i = 1; i < (1ll << n); i++) {
cnt = 0;
for (int j = 0; j < n; j++) {
if ((1ll << (j)) & i) {
cnt++;
}
}
if (cnt != l)continue;
int flag[20] = {0};
ll tot = 0;
for (int j = 0; j < n; j++) {
if ((1ll << (j)) & i) {
flag[j + 1] = 1;
tot += aa[j + 1].va;
tot += bb[j + 1].va;
}
}
int cnt1 = 0, cnt2 = 0;
for (int j = 1; j <= n && (cnt1 != k - l || cnt2 != k - l); j++) {
//if (flag[a[j].id])continue;
if (cnt1 != k - l&&!flag[a[j].id])tot += a[j].va, cnt1++;
if (cnt2 != k - l&&!flag[b[j].id])tot += b[j].va, cnt2++;
}
mx=max(mx,tot);
}
printf("%lld\n", mx);
}
return 0;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 54.31 us | 36 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #2 | 445.08 us | 36 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #3 | 426.54 us | 36 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #4 | 13.7 ms | 36 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #5 | 95.809 ms | 36 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #6 | 1 s | 536 MB + 256 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #7 | 37.21 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #8 | 64.45 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #9 | 62.27 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #10 | 63.05 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #11 | 63.59 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #12 | 63.29 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #13 | 63.07 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #14 | 62.88 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #15 | 63.56 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #16 | 63.3 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #17 | 62.7 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #18 | 63.07 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #19 | 64.37 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #20 | 63.79 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #21 | 63.05 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #22 | 63.28 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #23 | 64.47 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #24 | 62.96 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #25 | 63.95 us | 32 KB | Runtime Error | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-04-03 17:14:29 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠