QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#198909 | #5146. Skills | 275307894a | WA | 92ms | 4964kb | C++14 | 1.7kb | 2023-10-03 18:33:28 | 2023-10-03 18:33:28 |
Judging History
answer
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd.next(1,n))
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define PB push_back
using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned ll;
using namespace std;const int N=1e3+5,M=210+5,K=2e3+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;
int n,m,k,x,y,z,A[N][3],f1[M][M],f2[M][M],f3[M][M],g1[M][M],g2[M][M],g3[M][M];
ll calc(int x){return x*(x-1)/2;}
void chk(int &x,int y){x<y&&(x=y);}
void Solve(){
int i,j,h;scanf("%d",&n);for(i=1;i<=n;i++) scanf("%d%d%d",&A[i][0],&A[i][1],&A[i][2]);
Me(f1,0);Me(f2,0);Me(f3,0);
for(i=n;i;i--) {
Mc(g1,f1);Mc(g2,f2);Mc(g3,f3);Me(f1,0);Me(f2,0);Me(f3,0);
for(j=0;j<=min(n-i+1,210);j++){
for(h=0;h<=min(n-i+1,210);h++){
chk(f1[min(j+1,210)][min(h+1,210)],g1[j][h]+A[i][0]);
if(j<210) chk(f2[1][min(h+1,210)],g1[j][h]+A[i][1]-calc(j+1));
if(h<210) chk(f3[1][min(j+1,210)],g1[j][h]+A[i][2]-calc(h+1));
if(j<210) chk(f1[1][min(h+1,210)],g2[j][h]+A[i][0]-calc(j+1));
chk(f2[min(j+1,210)][min(h+1,210)],g2[j][h]+A[i][1]);
if(h<210) chk(f3[min(j+1,210)][1],g2[j][h]+A[i][2]-calc(h+1));
if(j<210) chk(f1[min(h+1,210)][1],g3[j][h]+A[i][0]-calc(j+1));
if(h<210) chk(f2[min(j+1,210)][1],g3[j][h]+A[i][1]-calc(h+1));
chk(f3[min(j+1,210)][min(h+1,210)],g3[j][h]+A[i][2]);
}
}
}
int Ans=0;for(i=1;i<=210;i++) for(j=0;j<=210;j++) Ans=max(Ans,max(f1[i][j],max(f2[i][j],f3[i][j])));printf("%d\n",Ans);
}
int main(){
int t;scanf("%d",&t);while(t--) Solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 4964kb
input:
2 3 1 1 10 1 10 1 10 1 1 5 1 2 3 6 5 4 7 8 9 12 11 10 13 14 15
output:
26 41
result:
ok 2 number(s): "26 41"
Test #2:
score: 0
Accepted
time: 19ms
memory: 4948kb
input:
1 200 6219 3608 2383 1139 2158 8611 6721 8216 8887 8736 6707 9755 7210 248 167 3849 276 8050 971 5062 1914 8290 1562 6017 8993 7990 3460 6323 6099 757 7652 4740 6117 6560 4206 180 3705 8906 5752 9619 8939 9696 793 6680 1777 384 3606 8772 9258 3906 709 4396 5083 6614 6057 4410 3132 8596 825 7437 6098...
output:
1505431
result:
ok 1 number(s): "1505431"
Test #3:
score: 0
Accepted
time: 17ms
memory: 4892kb
input:
1 200 7577 2771 7429 8435 7489 1440 1929 8819 818 7849 8462 8761 3344 5938 3673 9434 8897 6486 4668 636 8139 4777 3305 4238 4221 3326 639 3879 7469 1590 6370 9514 4307 6243 3301 8122 4967 184 9327 6142 1710 399 6814 9296 6270 5663 3564 5442 8315 1295 869 2635 7975 4837 9613 9439 4012 6660 1861 368 8...
output:
1497632
result:
ok 1 number(s): "1497632"
Test #4:
score: 0
Accepted
time: 39ms
memory: 4872kb
input:
1 300 0 10000 0 0 10000 0 0 10000 0 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 1000...
output:
2975228
result:
ok 1 number(s): "2975228"
Test #5:
score: 0
Accepted
time: 92ms
memory: 4888kb
input:
1 500 10000 0 0 10000 0 0 10000 0 0 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10...
output:
4955301
result:
ok 1 number(s): "4955301"
Test #6:
score: -100
Wrong Answer
time: 3ms
memory: 4880kb
input:
20 10 6219 3608 2383 1139 2158 8611 6721 8216 8887 8736 6707 9755 7210 248 167 3849 276 8050 971 5062 1914 8290 1562 6017 8993 7990 3460 0 0 0 10 7652 4740 6117 6560 4206 180 3705 8906 5752 9619 8939 9696 793 6680 1777 384 3606 8772 9258 3906 709 4396 5083 6614 6057 4410 3132 1 0 0 10 6098 4958 7691...
output:
71058 70170 68633 74398 65916 65053 62882 65101 62730 71037 64502 71948 54366 66300 74357 70246 65961 78875 58700 72180
result:
wrong answer 1st numbers differ - expected: '71054', found: '71058'