QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#647716 | #7279. Tricks of the Trade | chenxinyang2006# | 5 | 28ms | 4304kb | C++20 | 1.8kb | 2024-10-17 15:23:02 | 2024-10-17 15:23:07 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define db double
#define ldb long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define eb emplace_back
#define SZ(S) (int)S.size()
//#define mod 998244353
//#define mod 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f
using namespace std;
template <class T>
void chkmax(T &x,T y){
if(x < y) x = y;
}
template <class T>
void chkmin(T &x,T y){
if(x > y) x = y;
}
inline int popcnt(int x){
return __builtin_popcount(x);
}
inline int ctz(int x){
return __builtin_ctz(x);
}
/*ll power(ll p,int k = mod - 2){
ll ans = 1;
while(k){
if(k % 2 == 1) ans = ans * p % mod;
p = p * p % mod;
k /= 2;
}
return ans;
}*/
int n,K;
int a[205],b[205],c[205];
ll ans[205][205],val[205][205];
int valid[205];
int main(){
// freopen("test.in","r",stdin);
// freopen("test.ans","w",stdout);
scanf("%d%d",&n,&K);
rep(i,1,n) scanf("%d",&a[i]);
rep(i,1,n) scanf("%d",&b[i]);
ll answer = -linf;
rep(l,1,n){
rep(r,l,n){
int m = r - l + 1;
ans[l][r] = -linf;
if(m < K) continue;
rep(i,1,m) c[i] = b[i + l - 1];
sort(c + 1,c + m + 1);
ans[l][r] = 0;
rep(k,l,r) ans[l][r] -= a[k];
rep(i,1,K) ans[l][r] += c[m - i + 1];
chkmax(answer,ans[l][r]);
}
}
rep(l,1,n){
rep(r,l,n){
if(ans[l][r] == answer) valid[r] = 1;
}
}
rep(l,1,n){
int pl = inf,pr = 0;
rep(r,l,n){
if(ans[l][r] == answer){
chkmin(pl,r);
chkmax(pr,r);
}
}
rep(r,pl,pr) if(valid[r]) assert(ans[l][r] == answer);
}
cerr << "fin\n";
printf("%lld\n",answer);
return 0;
}
详细
Subtask #1:
score: 5
Acceptable Answer
Test #1:
score: 5
Acceptable Answer
time: 0ms
memory: 3808kb
input:
5 3 3 5 2 3 6 2 1 5 2 3
output:
-1
result:
points 0.50 first question correct
Test #2:
score: 5
Acceptable Answer
time: 28ms
memory: 4120kb
input:
200 40 81 50 87 91 54 1 77 68 19 84 28 81 45 64 4 13 25 89 12808135 86 40 73 47 18 82 79 11 96 16 34 80 36 8 5 60 76 86 84 36 37 96 55 68 12807879 51 89 57 30 100 11 44 19 96 32 9 68 41 12808009 5 58 12807939 92 68 67 78 32 57 49 71 92 64 35 89 76 81 36 6 6 53 31 85 79 5 85 1 91 17 37 25 91 54 29 47...
output:
12807909
result:
points 0.50 first question correct
Test #3:
score: 5
Acceptable Answer
time: 7ms
memory: 4240kb
input:
200 41 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
81
result:
points 0.50 first question correct
Test #4:
score: 5
Acceptable Answer
time: 0ms
memory: 3808kb
input:
5 2 1 6 1 5 2 4 1 6 2 4
output:
2
result:
points 0.50 first question correct
Test #5:
score: 5
Acceptable Answer
time: 0ms
memory: 4000kb
input:
7 3 5 1 1 1 1 1 5 1 1 1 1 1 1 1
output:
0
result:
points 0.50 first question correct
Test #6:
score: 5
Acceptable Answer
time: 13ms
memory: 4176kb
input:
200 100 142654162 64490063 513345044 219974445 84112685 711899650 33120992 176027514 802361343 2414916 941549932 786288853 94273368 829024564 352947721 355629698 903479794 326383768 720620114 271371691 786997028 138881060 711795174 536092340 290169962 938690480 710723910 231424065 468554799 44519400...
output:
-2461503019
result:
points 0.50 first question correct
Test #7:
score: 5
Acceptable Answer
time: 0ms
memory: 4204kb
input:
200 199 392097713 864387769 236976435 989793783 997090826 107508554 219275702 329027733 181833481 896113693 791833669 652173288 689106070 645879177 369017772 739620594 465647432 361649152 704125516 383540722 576805937 293955811 610328615 867720036 757212267 369257718 556736284 696523840 140108544 86...
output:
-105367042470
result:
points 0.50 first question correct
Test #8:
score: 5
Acceptable Answer
time: 19ms
memory: 4256kb
input:
200 3 746 47 728 416 642 210 910 989 579 230 210 69 492 889 382 557 765 799 530 654 409 580 142 660 984 564 669 995 761 37 626 486 787 448 702 896 828 141 506 819 513 930 633 306 458 592 317 358 1 399964794 122 33 989 530 924 440 783 752 486 723 756 383 521 710 203 880 43 938 619 108 312 627 838 897...
output:
700075000
result:
points 0.50 first question correct
Test #9:
score: 5
Acceptable Answer
time: 17ms
memory: 4268kb
input:
200 50 880 306 671 420 987 969 816 443 151 370 474 369 971 785 908 523 671 790 123 453 578 788 484 883 451 352 182 605 216 157 129 401 879 201 308 556 580 479 696 481 20 785 109 138 893 293 779 549 745 93 611 656 380 571 634 483 565 882 375 941 632 813 224 65 446 920 825 720 497 861 267 128 449 332 ...
output:
778903
result:
points 0.50 first question correct
Test #10:
score: 5
Acceptable Answer
time: 4ms
memory: 4264kb
input:
200 88 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
114
result:
points 0.50 first question correct
Test #11:
score: 5
Acceptable Answer
time: 12ms
memory: 4304kb
input:
200 66 38 28 65 41 3 16 72 66 3 23 24 68 2 11 80 18 66 24 10 25 73 86 84 40 67 21 30 90 2 9 21 3 19 59 43 90 82 35 26 38 60 27 63 41 56 44 30 95 77 15 87 49 90 80 43 3 27 55 64 26 14 84 99 53 18 28 2 92 12 58 28 56 66 83 21 2 14 91 88 60 61 67 18 92 42 39 52 5 17 74 9 61 25 39 29 36 72 30 57 48 67 9...
output:
676940628
result:
points 0.50 first question correct
Subtask #2:
score: 0
Runtime Error
Dependency #1:
50%
Acceptable Answer
Test #12:
score: 5
Acceptable Answer
time: 0ms
memory: 3936kb
input:
5 3 3 5 2 3 6 2 1 5 2 3
output:
-1
result:
points 0.50 first question correct
Test #13:
score: 5
Acceptable Answer
time: 28ms
memory: 4296kb
input:
200 40 81 50 87 91 54 1 77 68 19 84 28 81 45 64 4 13 25 89 12808135 86 40 73 47 18 82 79 11 96 16 34 80 36 8 5 60 76 86 84 36 37 96 55 68 12807879 51 89 57 30 100 11 44 19 96 32 9 68 41 12808009 5 58 12807939 92 68 67 78 32 57 49 71 92 64 35 89 76 81 36 6 6 53 31 85 79 5 85 1 91 17 37 25 91 54 29 47...
output:
12807909
result:
points 0.50 first question correct
Test #14:
score: 5
Acceptable Answer
time: 7ms
memory: 4128kb
input:
200 41 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
81
result:
points 0.50 first question correct
Test #15:
score: 0
Runtime Error
input:
6000 5999 438826959 520928239 904033734 666301250 559942226 360928183 64116981 707910123 172582807 906896526 260719797 854677975 121544450 575670562 394652708 155768149 22161417 359291091 499618825 502667952 59650494 257306042 963408276 303083778 352667915 75773679 278285664 105026391 349323928 2277...
output:
result:
Subtask #3:
score: 0
Wrong Answer
Test #30:
score: 5
Acceptable Answer
time: 0ms
memory: 3948kb
input:
5 2 1 6 1 5 2 4 1 6 2 4
output:
2
result:
points 0.50 first question correct
Test #31:
score: 0
Wrong Answer
time: 1ms
memory: 3864kb
input:
250000 2 18 35 29 35 18 610084694 18 35 29 35 18 448867144 18 35 29 35 18 971272498 18 35 29 35 18 890430190 18 35 29 35 18 655685684 18 35 29 35 18 234608237 18 35 29 35 18 894586749 18 35 29 35 18 442195168 18 35 29 35 18 341564617 18 35 29 35 18 985069087 18 35 29 35 18 967546483 18 35 29 35 18 5...
output:
-306381587
result:
wrong answer wrong answer on the first question
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
50%
Acceptable Answer
Dependency #2:
0%